Possible Duplicate:
jQuery, Select by attribute value, adding new attribute
jQuery - How to select by attribute
please consider this code:
<p>11111111111111</p>
<p MyTag="nima">2222222222</p>
<p>33333333333</p>
<p MyTag="Sara">>4444444444</p>
how I can select All p
tag with attribute MyTag
?
thanks
This question is related to
javascript
jquery
jquery-selectors
As described by the link I've given in comment, this
$('p[MyTag]').each(function(index) {
document.write(index + ': ' + $(this).text() + "<br>");});
works (playable example).
Source: Stackoverflow.com