It's not a secret anymore!
The moose likes HTML, CSS and JavaScript and the fly likes getElementById()  Issue in IE10 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "getElementById()  Issue in IE10" Watch "getElementById()  Issue in IE10" New topic

getElementById() Issue in IE10

rams srees

Joined: Mar 18, 2013
Posts: 1
Legacy code has input object (drop down menu) whose 'id' was not specified but 'name' was configured. In the code, getElementById() was used by passing 'name' as the argument, IE8 used to return the object, however IE10 now returns 'null'. I am assuming, not configuring 'id' is not correct and the web standard doesn't suggest using 'name' as 'id' when 'id' is not given, give that, IE8 could very well have returned a 'null' in this case. This code is is present in over hundred views, now with IE10 out, it is anticipated that users will start upgrading to IE10. Is there a solution other than having to change the code in all the hundred+ views?
Rakesh Keerthi
Ranch Hand

Joined: Jul 16, 2012
Posts: 152
i would suggest, if you are using Netbeans IDE, this can be done a bit easily.
Step:1- select the main project folder->ctrl+H(Find & Replace).
Step:2- enter the name and its value (for ex: name="Hello") and Replace with name and id(ex: name="Hello" ID="Hello").
Step:3- Below you can see into how many places this replacement is going to be done and hit a replace all, it gets replaced.

This link gives you more Info

Hope this helps Happy Coding
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
There is no way that I know of in IE10 to hijack getElementById.

What you could do is a find in replace in the whole project to call a different function.

THIS IS A HACK! You really need to fix the real problem of poor coding practices.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

I agree with Eric. Fix the problem rather than hacking in a new problem that will make matters even worse.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: getElementById() Issue in IE10
It's not a secret anymore!