Possible Duplicate:
Opinion: in HTML, Possible Duplicate IDs or Non-Standard Attributes?
I’m currently writing a tool that uses jQuery clone to clone an element with an id. It is possible that this cloned element may have children that could also have ids. As of now I am not making any of the cloned elements ids unique. I was curious if this could cause any browser related issues besides the obvious unable to find a single element using an Id selector. In particular I’m curious if older browsers could have issues with duplicated Ids.
To be clear I have not seen any issues, but I am only able to test native IE8 as the oldest browser.
My assumption is that it could cause some minor display issues due to it being invalid HTML, and that is all.
Are there any repercussions of using clone on elements with ids and not making their ids unique beyond invalid HTML?
The HTML will be invalid yes, but 99% of the time that doesn’t actually cause any rendering issues.
You will have issues with your javascript if you use
getElementById. You only get the first occurrence of the element. See here.