title: How to copy newline characters from HTML div to textarea in jQuery?
body: <p>Consider the following HTML page fragment:</p>
  
  <pre><code>&lt;div id='myDiv'&gt;
      Line 1.&lt;br /&gt;
      Line 2&lt;br /&gt;
      These are &amp;ltspecial&amp;gt; characters &amp;amp; must be escaped !@@&amp;gt;&amp;lt;&amp;gt;
  &lt;/div&gt;
  &lt;input type='button' value='click' id='myButton' /&gt;
  &lt;textarea id='myTextArea'&gt;&lt;/textarea&gt;
  
  &lt;script&gt;
      $(document).ready(function () {
          $('#myButton').click(function () {
              var text = $('#myDiv').text();
              $('#myTextArea').val(text);
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>First, there is a div element with id <code>myDiv</code>.  It contains some text similar to what might be retrieved form a SQL database at runtime in my production web site.</p>
  
  <p>Next, there is a button and a textarea.  I want the text in <code>myDiv</code> to appear in the textarea when the button is clicked.</p>
  
  <p>However, using the code I provided, the line-breaks are stripped out.  What can I do about this, taking into consideration that escaping special characters is absolutely non-negotiable?</p>