title: javascript | save textarea value with line breaks
body: <p>I have a code where it saves multiple textarea values in a text file. However, it does not display the line breaks I indicated after saving it. It only identifies the line breaks w/c are manually put within the textarea. Below is the code. Please help.</p>
  
  <pre><code>&lt;script&gt;
      var TestVar = new Array(); 
      var i = 0;
      function save()
      {
          TestVar[i] = document.getElementById("text1").value + "\n" + document.getElementById("text2").value;
          mydoc = document.open();
          mydoc.write(TestVar);
          mydoc.execCommand("saveAs",true,"TicketID.txt");
          mydoc.close();
      }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id=formtest&gt;
          &lt;textarea name="textarea" id="text1"&gt;&lt;/textarea&gt;
          &lt;textarea name="textarea" id="text2"&gt;&lt;/textarea&gt;
          &lt;input type="button" value="save" onclick="save()"&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>