title: Copying stored text in a table and then display it back into a textarea
body: <p>I need your help,</p>
  
  <p>How can I go about copying text (with the line breaks included) from my table and put it back into the textarea “newtext”</p>
  
  <p>My existing coding doesn't seem to be working.</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
  
  &lt;style type="text/css"&gt;
  
  .box { width: 400px; height: 50px; }
  
  &lt;/style&gt;
  
  &lt;script type="text/javascript"&gt;
  
  function ta() {
  
      taValue = document.getElementById("ta").value
  
      taValue = taValue.replace(/\n/g, '&lt;br/&gt;')
  
      document.getElementById("tatext").innerHTML = taValue
  }
  
  function text2area() {
  
      document.getElementById("newtext").innerHTML = document.getElementById("tatext").innerHTML
  
  }
  
  &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;textarea class="box" id="ta" onkeyup="ta()"&gt;&lt;/textarea&gt;
  
  &lt;table id="tatable"&gt;&lt;tr&gt;&lt;td&gt;&lt;div id="tatext"&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
  &lt;br&gt;
  
  &lt;input type="button" onclick="text2area()" value="move text"&gt;
  
  &lt;br&gt;&lt;br&gt;
  
  &lt;textarea class="box" id="newtext"&gt;&lt;/textarea&gt;
  
  &lt;/html&gt;
  </code></pre>