javascript - jQuery : select all element with custom attribute -


possible duplicate:
jquery, select attribute value, adding new attribute
jquery - how select attribute

please consider code:

<p>11111111111111</p> <p mytag="nima">2222222222</p> <p>33333333333</p> <p mytag="sara">>4444444444</p> 

how can select p tag attribute mytag?

thanks

use "has attribute" selector:

$('p[mytag]') 

or select 1 attribute has specific value:

$('p[mytag="sara"]') 

there other selectors "attribute value starts with", "attribute value contains", etc.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -