jQuery select number of tags

Posted by ninumedia on Stack Overflow See other posts from Stack Overflow or by ninumedia
Published on 2010-06-15T06:43:03Z Indexed on 2010/06/15 6:52 UTC
Read the original article Hit count: 249

Filed under:
|

I have multiple comment ids I want to reset to a default value.

Ex:

<a id="comments_inner_toggle_45">example 1</a>
<a id="comments_inner_toggle_608">example 2</a>
<a id="comments_inner_toggle_28">example 3</a>
...

How can I write the correct tag in jQuery to select every tag with an id of "comments_inner_toggle_" and perform some operation on it?

I think it's something similar to:

$('a[id|=comments_inner_toggle_]').whatever

This is wrong however because the code above will only match the tag with "comments_inner_toggle_" and not with a number appended at the end. How can I fix this? thanks for the help! :)

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-selectors