The moose likes HTML, CSS and JavaScript and the fly likes innerHTML does not work in IE? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "innerHTML does not work in IE?" Watch "innerHTML does not work in IE?" New topic
Author

innerHTML does not work in IE?

Rajesh Khan
Ranch Hand

Joined: Oct 16, 2011
Posts: 230
Hi I am facing a simple problem it seems as if IE cant recognize my innerHTML and returns with a run time error it works in firefox and chrome
Here is what i am trying to do

the string gets displayed in the console but i get a run time error on the next line.
The element username is present in a div element. any ideas why i am getting this ??

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56192
    
  13

Not enough info. What's in rx? Have you verified that the element is being fetched? What's the exact error? Just saying "I got an error" isn't helpful.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Marcin Kwiatkowski
Ranch Hand

Joined: Aug 06, 2007
Posts: 32

innerHTML is broken in IE and depending on your use case there are different workarounds. For example:
Rajesh Khan
Ranch Hand

Joined: Oct 16, 2011
Posts: 230
Bear Bibeault wrote:Not enough info. What's in rx? Have you verified that the element is being fetched? What's the exact error? Just saying "I got an error" isn't helpful.


Rx is a string which the java function received as a response from an http asynch request. And yes i verified it. by using console.log(rx) also it works in firefox but not in IE . All i get is "runtime error" according to IE 8.0
Marcin Kwiatkowski
Ranch Hand

Joined: Aug 06, 2007
Posts: 32

You have to open Developers Tools (F12) in order to access console in IE8.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6
What is username? Is it a input, div, etc?
What is the string you are trying to add to the page?

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56192
    
  13

Rajesh Khan wrote:Rx is a string which the java function received as a response from an http asynch request.
That does not answer my question.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: innerHTML does not work in IE?
 
Similar Threads
responseXML.documentElement returns null object
Need a little help with the map container
Help documenting this method
How to set html value to Dojo digit.Editor
Execute JavaScript function present in HTML fragment loaded using AJAX