getElementById(’description’) in IE
document.getElementById() in IE has some issues. The problem can be spotted when you have a page element with an id "description" and meta tag with a name "description" IE considers the meta tag to be the one that should be returned by getElementById(). Which is, of course, wrong. ID is an ID and name is a totally different thing.
Anyway, heads up for that IE behaviour.
As an illustration, here in WordPress (the blogging tool that powers the page you're reading) there's a meta tag, called "generator", like this:
<meta name="generator" content="WordPress 1.5" />
So if you do:
alert(document.getElementById('generator'))
this will return null in FireFox, the way it was meant to be (by w3c, that is) and in IE, you'll get [Object]
Try it...
Try it with the "content" property...
(The second example will give an error in FireFox as there is no "content" property of null.

October 30th, 2006 at 10:14 am
IE7 is still suffering from this bug…
February 9th, 2007 at 1:07 pm
I just ran into this bug. I’m having two login forms on a page. The corresponding elements placed in different forms have the same names but different ids. Still when using getElementByID IE grabs the value of the first field it finds with that name. Totally wrong of course… But this is something we’re all used to when dealing with MS software.
Did you happen to find a workaround for it or something?
February 10th, 2007 at 12:34 pm
Thanks Janos for pointing that out. This is redicioulous, getElementById is not what it is
Apparently IE gets a little confused what is a
nameand what is anidattribute.I did this little test as an illustration, this alert()s 1 in IE and 2 in Firefox.
<form action="#"> <input type="text" id="someid1" name="t2" value="1" /> <input type="text" id="t2" name="t2" value="2" /> </form> <a href="javascript:alert(document.getElementById('t2').value)">test</a>September 25th, 2007 at 11:39 pm
This site: http://webbugtrack.blogspot.com/2007/08/bug-152-getelementbyid-returns.html
Has the perfect solution to this bug. It redefines the method so that IE always returns the correct object without causing a huge performance hit.
Check it out, it works great!
November 18th, 2008 at 4:11 pm
Well it was about time I found this page. Me and my teammates just wasted 3 hours on our project because of that. You totally saved the day haha. Microsoft should really fix this.
Thank you