mark mark - 14 days ago 6x
jQuery Question

How to select all elements with a particular ID in jQuery?

I'm trying to select all

s with the same ID in jQuery. How do i do it?

I tried this and it did not work

//do stuff;


I would use Different IDs but assign each DIV the same class.

<div id="c-1" class="countdown"></div>
<div id="c-2" class="countdown"></div>

This also has the added benefit of being able to reconstruct the IDs based off of the return of jQuery('.countdown').length

Ok what about adding multiple classes to each countdown timer. IE:

<div class="countdown c-1"></div>
<div class="countdown c-2"></div>
<div class="countdown c-1"></div>

That way you get the best of both worlds. It even allows repeat 'IDS'