title: Writing html of selector element to textarea with jquery
body: <p>I'm trying to write the html of various elements on my page to a textarea element. If the id of my textarea is 'textarea_id' and I have a string of html in the var, <code>html_str</code>, I can write the string to my text area with</p>
  
  <pre><code>$('#textarea_id').html(html_str);
  </code></pre>
  
  <p>This seems to work in all cases except when <code>html_str</code> contains markup for a selector element. In this case, only what appears to be spaces and newline characters are written to the textarea and afterward, only these characters can be written until the textarea is cleared with</p>
  
  <pre><code>$('#textarea_id').html('');
  </code></pre>
  
  <p>regardless of the content of <code>html_str</code>. The number spaces and newline characters does not correspond to the number of characters in <code>html_str</code>
  Using</p>
  
  <pre><code>document.getElementById('textarea_id').innerHTML = html_str;
  </code></pre>
  
  <p>doesn't present this problem. If anyone has any insights on this, I'd like to understand the difference in mechanics here. Thanks</p>