title: javascript Replacing \n with <br> inside createTextNode
body: <p>I have a String with <code>\n</code> - line breaks in Javascript, that I want to replace for another text using <code>createTextNode()</code> in Javascript.  </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  function changeText() {
  
  var Explanation="Test\n Test2";
  
  var parent3 = document.getElementById("The_Explanation"); 
  parent3.innerHTML='';  
  var myP3 = document.createElement("p");
  var myText3 = document.createTextNode(""+Explanation);
  myP3.appendChild(myText3);
  parent3.appendChild(myP3);
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>All tries to get the line break into the new text failed so far. All functions that replace <code>\n</code> to <code>&lt;br&gt;</code> only bring me to the result </p>
  
  <pre><code>"Test&lt;br&gt; Test2"
  </code></pre>
  
  <p>Any ideas anyone?</p>