jquery - Search an DOM element by attribute name -


how can search (using jquery) dom element has attribute given name (not attribute value)?

for example:

<div id="div1">   <div id="div2" myattr="myvalue">   </div> </div> 

i search every element under #div1 (inclusive) has has attribute named myattr (so #div2 element returned).

use selector:

$('#div1[myattr], #div1 [myattr]') 

this #div1 attribute myattr , items under #div1 has attribute named myattr.

documentation


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -