getElementById function retrieves element by the "id" attribute, but IE browser also checks "name" attribute too if the "id" doesn't exist. I noticed many web pages were code in the way, it calls "getElementById" and only "name" attribute exist for the element, so can you add this simple check if the "id" exist, use "id", otherwise use "name"? thanks
Could you please give examples of real sites coded this way?
(In reply to comment #1) > Could you please give examples of real sites coded this way? The customer service section of the Israeli Orange franchise, <https://direct.orange.co.il/selfservice/>.
the reason why some sites are coded this way is because of some Web Framwork, such as "Struts" doesn't generate "id" attribute by default, but it generates "name" attribute all the time, and getElementById works fine in IE even without "id" attribute, some lazy developers don't even bother to go back fix this. Struts was so popular, I saw this problem since begining.
Opera is apparently going to remove this quirk from their 9.50 release: "Removed IE-compatibility where Document.getElementById treated name and id attributes the same, which caused problems with jQuery." Still, this is a compatibility issue that we should consider fixing.
*** This bug has been marked as a duplicate of 6006 ***