Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getElementById() Issue in IE10

 
rams srees
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 64973
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Eric. Fix the problem rather than hacking in a new problem that will make matters even worse.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic