Hacker News new | ask | show | jobs
by robocat 1665 days ago
It is uncommon knowledge that id’s do not have to be unique.

document.querySelectorAll('#test').length will return 2 if there are two elements on the page with the same id=test attribute. I personally avoid using that ‘feature’ because it would confuse many people, but it is important to know if you run into certain bugs in code.