Finding all elements whose attribute value starts with certain characters using jQuery.

Vishalneeraj-24503
Posted by Vishalneeraj-24503 under jQuery category on | Points: 40 | Views : 375
To find out all elements whose attribute value starts with certain characters we can use ^= operator.
For Example:-
<input id = "txtName" type = "text" data-id = "txt Name" />
<input id = "FirstNameF" type = "text" data-id = "name txt" />
<input type = "button" value = "Button" id = "btnTest" />

<script>
$(function () {
$("input[id^='tx']").css("border", "1px solid red");
});
</script>

Comments or Responses

Login to post response