title: clipboardjs copy the html contents of a div to the clipboard
body: <p>I trying copy the html contents of multiple divs using <a href="https://github.com/zenorocha/clipboard.js" rel="nofollow noreferrer">zenorocha clipboardjs</a> javascript plugin. Please don't post other alternatives as I would like give this plugin a go, as it seems solid on the browsers that I want to cover.</p>
  
  <p>I've looked at <a href="https://github.com/zenorocha/clipboard.js/issues/321" rel="nofollow noreferrer">this issue</a> on zenorocha's github, but this code just seems to return an <code>Uncaught TypeError: Illegal constructor</code>.</p>
  
  <pre><code>new Clipboard('.copy', {
      text: function() {
          var htmlBlock = document.querySelector('.yourSelector');
          return htmlBlock.innerHTML;
      }
  });
  </code></pre>
  
  <p>I've created an <a href="https://jsfiddle.net/joshmoto/qLord78p/" rel="nofollow noreferrer">example fiddle</a> if anyone can help me use <a href="https://github.com/zenorocha/clipboard.js" rel="nofollow noreferrer">clipboardjs</a> to copy the html content of a div.</p>
  
  <p><strong>JS</strong></p>
  
  <pre><code>// copy to clipboard
  new Clipboard('.copy');
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div id="content_1"&gt;
     &lt;div&gt;&lt;b&gt;Heading Post 1&lt;/b&gt;&lt;/div&gt;
     &lt;div&gt;Blah, blah, blah&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;button class="copy" data-copy-element="content_1"&gt;
     Copy to clipboard
  &lt;/button&gt;
  </code></pre>
  
  <p>I've made up a new data attribute called <code>data-copy-element</code> as there will be multiple buttons and content blocks on a single page.</p>
  
  <p>See fiddle here <a href="https://jsfiddle.net/joshmoto/qLord78p/" rel="nofollow noreferrer">https://jsfiddle.net/joshmoto/qLord78p/</a></p>
  
  <p>Is this actually possible using <a href="https://github.com/zenorocha/clipboard.js" rel="nofollow noreferrer">zenorocha clipboardjs</a>?</p>
  
  <p>Thanks in advance.</p>