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

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -