Although there are other correct answers here (for example, using classes), from an academic point of view, of course, it is possible to have multiple divs with the same ID, and you can select them using jQuery.
When you use
jQuery("#elemid")
it selects only the first item with the given ID.
However, when you select by attribute (for example, id in your case), it returns all the relevant elements, for example:
jQuery("[id=elemid]")
This, of course, works for selection by any attribute, and you can further refine your choice by specifying the appropriate tag (for example, div in your case)
jQuery("div[id=elemid]")
mydoghasworms Jul 19 '11 at 9:02 2011-07-19 09:02
source share