What is the code for a new line or a carriage return to render properly in FF and IE?
here’s the line I’m adding:
var textNode = document.createTextNode(“Text…” + “\n”);
this only puts whitespace.
I’ve also tried \r\n, ‘
’, ’
’
None seem to work.
What is the code for a new line or a carriage return to render properly in FF and IE?
here’s the line I’m adding:
var textNode = document.createTextNode(“Text…” + “\n”);
this only puts whitespace.
I’ve also tried \r\n, ‘
’, ’
’
None seem to work.
Subject: Javascript/DOM new line break?
You’d need to create a new element node to insert a
. Plain whitespace follows the same rules as if you had typed multiple spaces or a return in the HTML in a text editor – it’s ignored except in preformatted elements (
, , , and so forth).
Subject: RE: Javascript/DOM new line break?
would the
be in the node’s value?
Subject: RE: Javascript/DOM new line break?
No. If you want to insert a line break, you have to insert three nodes into the parent – the first text node (before the break), the
element, then the second text node.