you are viewing a single comment's thread
view the rest of the comments
[–] 39 points 9 months ago* (2 children)

If your element has an id, you can just reference it from the window scope

This is brittle, as defining a global variable with the same name (or the browser adding a API with the same name) will override it. This functionality was only kept for backwards compatibility with sites designed for Internet Explorer. The spec says to use getElementById instead.

  • source
  • parent
  • hideshow 2 child comments