I insert several textNodes in javascript, and can’t figure out how to separate them with carriage returns. I’ve tried putting “\n”, “\r”, and “
” but none of them work
var textNode = document.createTextNode("Node on line 1");
element.appendChild(textNode);
textNode = document.createTextNode("Node on line 2");
element.appendChild(textNode);
I want this to appear as:
Node on line 1
Node on line 2
NOT
Node on line 1Node on line2
Any tips on how I can accomplish this ?
Use
<br>to separate them as like this