Two HTML elements with same id attribute: How bad is it really?
- by danludwig
Just browsing the google maps source code. In their header, they have 2 divs with id="search" one contains the other, and also has jstrack="1" attribute. There is a form separating them like so:
<div id="search" jstrack="1">
<form action="/maps" id="...rest isn't important">
...
<div id="search">...
Since this is google, I'm assuming it's not a mistake.
So how bad can it really be to violate this rule? As long as you are careful in your css and dom selection, why not reuse id's like classes? Does anyone do this on purpose, and if so, why?