jQuery [name="value"][name2="value2″]Selector

jQuery 选择器jQuery Selector

Examples

Use a compound selector to find qualifying input boxes and set the value.

<input id="man-news" name="man-news" /> <input name="milkman" /> <input id="letterman" name="new-letterman" /> <input name="newmilk" /> <script> $(function () { $( "input[id][name$='man']" ).val( "Only this input box" ); }) </script>

Try it yourself »

Definition and Usage

[name="value"][name2="value2"] is a compound attribute selector, used when multiple conditions need to be met at the same time.


Syntax

$( "[attributeFilter1][attributeFilter2][attributeFilterN]" )

Parameters Description
attributeFilter1 Selector type: attribute selector
attributeFilter2 Selector type Another attribute selector, used to further narrow down the scope
attributeFilterN Selector type Any number of attribute selectors


jQuery 选择器jQuery Selector

Other Extensions