Answer the question
In order to leave comments, you need to log in
getElementById in IE9
Can anyone explain to me how this can even be?
alert(document.getElementById(' ordinance_law_coverage ').id);
gives me the string ordinance_law_coverage0 .
There is an element on the page with id "ordinance_law_coverage".
There is also an element with an id of "ordinance_law_coverage0" and a name attribute of "ordinance_law_coverage".
So it turns out that in IE9 getElementById can in some cases find an element by name instead of id?
Answer the question
In order to leave comments, you need to log in
Yep, found the answer. msdn.microsoft.com/en-us/library/ms536437 (v=vs.85).aspx
getElementById: Returns the first object with the specified ID or NAME.
This should have been figured out.
What element do you have an attribute on name
and why?
In which X-UA-Compatible mode do you have IE9?
In my particular case, the Name of the checkbox. It is accompanied by an input type=hidden element whose ID matches the checkbox name. hidden holds the value associated with the checkbox. It is not possible to change the scheme of this whole miracle at the moment (the project is old and large, legacy features and all that).
The same getElementById behavior appears in both IE7 and IE8. Apparently, the MC thinks this is normal behavior.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question