It's against the W3c spec for the DOM. The whole point of an ID is that it's
unique on the page. Duplicate IDs lead to potential errors.

If you need to have more than one of a thing on a page, then use a class. 

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of riotbrrd
Sent: Tuesday, March 31, 2009 11:24 AM
To: jQuery (English)
Subject: [jQuery] A general Javascript question: duplicate IDs in a
document?


I realize this is not jQuery specific, but I figured you guys might have
some good advice...

I often find myself wanting to assign the same ID to multiple elements in a
document -- typically when there are several versions of an element which
display at different times. Is there a good reason NOT to do this? If so,
what's a better practice?

thanks,
Kim


Reply via email to