title: Can you use document.execCommand('copy') on the contents of a div?
body: <p>If I copy an html table manually, I can paste it into a Google Doc with the formatting preserved (it looks like a table).</p>
  
  <p>How can I copy the contents programmatically, with a button, and paste as an html table? Something like the following...</p>
  
  <pre><code>evar copydeck = $("&lt;div&gt;").html(htmlToInsert);
  $('body').append(copydeck);
  copydeck.select();
  document.execCommand('copy');
  copydeck.remove();
  </code></pre>
  
  <p>The above code does not work...but this does:</p>
  
  <pre><code>copydeck = $("&lt;textarea&gt;").val(this.list.join("\r\n"));
  $('body').append(copydeck);
  copydeck.select();
  document.execCommand('copy');
  copydeck.remove();
  </code></pre>
  
  <p>I guess it is because the element must be selectable - like an input or htmlarea field. But they can't hold html (or it is just plain text, not html).</p>
  
  <p>Any way to copy and paste HTML?</p>