:text
selectorThe jQuery :text
selector is used to select all elements of type text.
$( "input:text" )
is not equivalent to $( "input[type=text]" )
in jQuery.Because :text
selects input elements that have no specified type attribute.
<input id="testID"> <script> $( "#testID" ).is( "[type=text]" ); // false $( "#testID" ).is( ":text" ); // true </script>
:text
selector Syntax$(':text')
:text
selector ExamplesIn below example,We will hightlight all text inputs.
Try now