Site Navigation

Wednesday, April 16, 2008

bug 403 - another getElementsByName() bugs in IE

Issue: #403
Affects: IE6, IE7
Fixed in: IE8 Beta 2

Related to (bug 411), another bug with getElementsByName( name ); has been noted.

If you dynamically change the name attribute of an element (e.g. an input box) it will affect the form submission, but in IE it won't actually change the name attribute. See these bugs: (bug 199), (bug 235), (bug 237), (bug 240) & (bug 242)

What this also means, is that in IE, if you try to retrieve the elements you have renamed, you will not be able to retrieve them.


<script type="text/javascript">
var myElem = document.forms[0].elements['oldname']; = 'newname';//can't use .setAttribute() due to another IE bug

//how many elements with the name 'newname' do we now have?
alert(document.getElementsByName('newname').length + ' elements found!');

In IE, this will alert ZERO.

Known Workarounds: None.

Related Issues: None.

Bug/Site Feedback |
Submit a bug