Overriding IE’s getElementById()

By Max Wilson on Mar 3, 2008


There is a well-known bug in the Internet Explorer implementation of the getElementById() method, which, contrary to the W3C standard, allows the method to return an element even if only the element’s name attribute matches the requested id. This snippet will easily correct that problem.


Further details available on the Web site.

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: overridingIE.js


Paste this code into the HEAD section of your HTML document.