How to insert a javascript textNode element on a newline
Use <br>
to separate them as like this
var br = document.createElement("br");
element.appendChild(br);
Rendering engines don't consider linefeed and carriage return to be rendered. Better if you use a <br />
like this:
var textNode = document.createTextNode("Node on line 1");
element.appendChild(textNode);
var linebreak = document.createElement('br');
element.appendChild(linebreak);
var linebreak = document.createElement('br');
element.appendChild(linebreak);
textNode = document.createTextNode("Node on line 2");
element.appendChild(textNode);
Thanks Doug Owings. Also http://jsfiddle.net/Q8YuH/3/