title: ClipboardJS : Copy the content of a <code> section
body: <p>I need to copy the content of a <code>&lt;code&gt;&lt;/code&gt;</code> section using <code>ClipboardJS</code>. When following the tutorial, I end up with this error :</p>
  <blockquote>
  <p>Uncaught Error: Invalid &quot;target&quot; value, use a valid Element</p>
  </blockquote>
  <p>Any workaround on this ?</p>
  <p>EDIT:</p>
  <p><strong>HTML</strong></p>
  <pre class="lang-html prettyprint-override"><code>&lt;code id=&quot;#foo&quot;&gt;my fantastic code&lt;/code&gt;
      &lt;button class=&quot;copy-button&quot; data-clipboard-action=&quot;copy&quot; data-clipboard-target=&quot;#foo&quot;&gt;
        Copy !
  &lt;/button&gt;
  </code></pre>
  <p><strong>JAVASCRIPT</strong></p>
  <pre class="lang-js prettyprint-override"><code>&lt;script type=&quot;text/javascript&quot;&gt;
    var clipboard = new Clipboard('.copy-button');
  
    clipboard.on('success', function(e) {
        console.info('Action:', e.action);
        console.info('Text:', e.text);
        console.info('Trigger:', e.trigger);
  
        e.clearSelection();
    });
  
    clipboard.on('error', function(e) {
        console.error('Action:', e.action);
        console.error('Trigger:', e.trigger);
    });
  &lt;/script&gt;
  </code></pre>