Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

JavaScript innerText problem

more options

I'm Web Developer and love firefox. I'm using Dreamweaver html engine. I add label in form and when i click the another link to change label text. I try, I search then I apply "document.getElementById("Label1").innerText = "Hello";" code but firefox is not perceive that code. I try Internet Explorer 8 it's detected. Please I love firefox please support that code...

I'm Web Developer and love firefox. I'm using Dreamweaver html engine. I add label in form and when i click the another link to change label text. I try, I search then I apply "document.getElementById("Label1").innerText = "Hello";" code but firefox is not perceive that code. I try Internet Explorer 8 it's detected. Please I love firefox please support that code...

All Replies (8)

more options

Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox.
http://forums.mozillazine.org/viewforum.php?f=25
You'll need to register and login to be able to post in that forum.

more options

If it is a problem with a Firefox 4.0 beta version then you need to post in the Firefox Builds forum

See http://forums.mozillazine.org/viewforum.php?f=23

innerText is IE only. Firefox does support innerHTML, but not innerText.

You can use textContent for Firefox: document.getElementById("Label1"). textContent = "Hello";

http://blog.coderlab.us/2005/09/22/using-the-innertext-property-with-firefox/

Izmjenjeno od strane cor-el

more options

Thank you. I try document.getElementById("Label1"). innerHTML = "Hello"; and it's done. Thanks..

more options

my innerHTML code is perfectly run in IE and mozilla beta version..its user agent is (rv 1.9.2.6)Gexxko/20100625 Firefox/3.6.6........but not working in Mozilla version 5 user agent is rv(2.0b1)Gecko/2010630 FireFox/4.0b1....i dont know the error..can u help me

more options

Both versions that you listed are outdated versions and have been replaced by newer versions Firefox 3.6.12 and Firefox 4.0 b7.

Did you try the latest Firefox 4.0 beta7 version?

more options

Hi, I m facing the java script problem like: "innerhtml " not works in IE8 and innerText Problem in mozilla firefox.

I want both browser to compatible solution if any one has then please guide me....


Thanks, Nilesh Pangul

more options

Yes i got the solution,

Use the uger agent of browser and user the innerText for IE and innerHTML for mozilla.. Thats it..


Thanks,

Nilesh Pangul

more options

Hi Friends, If InnerHTML is not working in IE and InnerText is not working in Mozilla Then, Use the bellow code navigator.userAgent.indexOf. Please check the example bellow,

//Code for Internet Explorer if(navigator.userAgent.indexOf('MSIE')!=-1) { window.document.getElementById('DisSelStatesCat').innerText ="("+countStates+") State(s) selected."; } else { //code for other browsers window.document.getElementById('DisSelStatesCat').innerHTML ="("+countStates+") State(s) selected."; }

Thanks,

Nilesh Pangul