lilnomad
08-16-2007, 02:27 PM
I have been working on this editor, and I finally found out by researching that innerText is not supported by FireFox, instead textContent is. So here is my code:
iText = document.getElementById('iView').textContent;
document.getElementById('iView').innerHTML = iText;
What I would like to happen is for iText to store the HTML tags and content, and then display it so it is no longer rendered. However, it stays rendered.
I know FireFox supports innerHTML, so I cannot figure out why this will not work.
Please, I would appreciate your help.
Codelphious
08-18-2007, 01:56 AM
I'm not sure what you mean by " display it so it is no longer rendered. However, it stays rendered.", but have you tried:
alert(document.getElementById('iView').innerHTML);
Jatinder
08-18-2007, 02:06 AM
It would be better to use Jquery or Prototype. These javascript libraries take care of these browser nuances internally and provide a unified API for DOM manipulation.
Codelphious
08-18-2007, 12:04 PM
Why use bloated APIs for something so trivial? :eek:
document.getElementById('iView').innerHTML is supported by every DOM supported browsers already.
Jatinder
08-18-2007, 01:29 PM
Why use bloated APIs for something so trivial?
That was just an advice. I guessed the OP was using Javascript for more than just changing the innerHTML.
HostSentry
08-18-2007, 11:51 PM
I have been working on this editor, and I finally found out by researching that innerText is not supported by FireFox, instead textContent is. So here is my code:
iText = document.getElementById('iView').textContent;
document.getElementById('iView').innerHTML = iText;
What I would like to happen is for iText to store the HTML tags and content, and then display it so it is no longer rendered. However, it stays rendered.
I know FireFox supports innerHTML, so I cannot figure out why this will not work.
Please, I would appreciate your help.
Do you mean that the browser will change the value of innerHTML once you assign it one? Fixing unclosed tags and rewriting hex colors to RGB colors?
Don't read the content with innerHTML, only write with it. If you want to save the content, then store it in the value of a hidden field.