Forum Moderators: open
Hello,Becomes
How are you today?
Hello, How are you today?
var val=e.firstChild.nodeValue.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
var val=e.innerHTML;
var val=e.innerText ? e.innerText : e.firstChild.nodeValue.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"); Thanks for any help in advance.
OH! Sorry. Now I see what you're saying (...writing).
Ya can't do that. Once the text content has been digested as HTML, unless it's contained within a pre-element, the whitespace has been stripped. What's gone is gone. Sorry.
[edited by: MarkFilipak at 6:49 pm (utc) on Mar. 6, 2008]
white-space:preto preserve white-space on the element, or convert CRs to <br> before displaying....?
<code>
Line 1
Line 3
Line 5
</code>
When you access the code tag's .innerHTML, IE will strip the empty line feeds and return this:
Line 1 Line 3 Line 5
There isn't a way to get .innerHTML (that I know of) in IE with line breaks. The parent element (code, pre, p, etc.) doesn't matter.
I've never tried overloading a tagName but I'd be very surprised if it isn't read-only and causes an exception: attempt to set a property that has only a getter.
[edited by: MarkFilipak at 10:31 am (utc) on Mar. 9, 2008]