The first thing that comes to my mind when i hear the word ID is that it’s something which is unique, Well it is in the case of ASP.NET server tags. But it seems that there is nothing wrong using same id’s for multiple tags if it’s not a server tag. So is it a problem at all?
Share
Your DOM selectors will fail.
document.getElementByIdwill only return the first match, and different javascript libraries might to their own funky stuff depending on the parsing they do on your selectors. plus, different browsers might also do their own when usingquerySelectorAll.I’d recommend to use a
classattribute instead of anid, even if you do not intend to address the elements with javascript. Repeating the sameidon a page is still invalid code and will lead to uncertain results.