JQuery, is there a way to select all elements on the page with a specific attribute? -


assuming create like:

<div> <p myattribute='hello'>text</p> .. </div> 

i want find on page, elements have myattribute, regardless of are. how do this?

you can use has-attribute selector, example:

$("[myattribute]") 

to elements attribute specific value, use attribute-equals selector, this:

$("[myattribute='hello']") 

you can find full list of attribute selectors available here.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -