Being able to select elements on the page based on their
Unfortunately it’s a temperamental feature. What would happen if you had:
Better yet, what happens here?
<div id="foo"></div> <div id="bar"></div> <script>var foo = document.getElementById('bar');</script>
So the nuances to calling an element based on it’s
[id] is simply this:
Don’t use it.
It’s not consistent, and not guaranteed to receive future support.
Personally I’d like to see this “feature” go the way of
document.all. It only causes more issues than it solves, and
document.getElementById, while certainly verbose, is meaningful and understandable.