How can I search (using jQuery) for a DOM element that has an attribute with a given name (not by attribute value)?
For example:
<div id="div1">
<div id="div2" myattr="myvalue">
</div>
</div>
I would like to search for every element under #div1 (inclusive) that has has an attribute named myattr (so that #div2 element will be returned).
Use this selector:
This will look for all
#div1with the attributemyattrand items under#div1that has an attribute namedmyattr.Documentation