Multiple Attribute Selectors $("[attr='value'][attr2='value2']")

You can use multiple jQuery attribute selector to select elements that have the given attributes assigned with given values. For example to select element <input type='text' value='someValue'> you can use $('[type=text][value='someValue]')


e.g. $("[id][name='apple']")

$("[attr='value'][attr2='value2']") selects elements matching all attribute selectors.

For example, $("[id][name='apple']") will find all elements that have attribute id and attribute name='apple'
<div id='id1' name='apple'>
<div name='apple'>
<div id='id2'>

Code: Find all elements where first attribute value starts with 'f' id^='f' & second attribute selector is name='apple'

<div id="fruit-1" name="apple">apple 1</div>
<div id="2-fruit" name="apple">apple 2</div>
<div id="fruit-3" name="apple">apple 3</div>
jQuery code
$("[id^='f'][name='apple']"); // selects elements where id^='f' & name='apple'

apple 1
apple 2
apple 3
jQuery selector $("[attr='value'][attr2='value2']")