I’m trying to select all <div>s with the same ID in jQuery. How do i do it?
I tried this and it did not work
jQuery('#xx').each(function(ind,obj){
//do stuff;
});
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would use Different IDs but assign each DIV the same class.
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:
That way you get the best of both worlds. It even allows repeat ‘IDS’