title: Copying to clipboard isn't working
body: <p>The sample I'm copying from on codepen works fine: <a href="http://codepen.io/SitePoint/pen/vNvEwE" rel="nofollow">http://codepen.io/SitePoint/pen/vNvEwE</a></p>
  
  <pre><code>&lt;label for="website"&gt;Website:&lt;/label&gt;
  &lt;input type="text" id="website" value="http://www.sitepoint.com/" /&gt;
  &lt;button data-copytarget="#website"&gt;copy&lt;/button&gt;
  
  &lt;label for="twitter"&gt;Twitter:&lt;/label&gt;
  &lt;input type="text" id="twitter" value="http://twitter.com/craigbuckler" /&gt;
  &lt;button data-copytarget="#twitter"&gt;copy&lt;/button&gt;
  
  /*
      Copy text from any appropriate field to the clipboard
    By Craig Buckler, @craigbuckler
    use it, abuse it, do whatever you like with it!
  */
  (function() {
  
      'use strict';
  
    // click events
    document.body.addEventListener('click', copy, true);
  
      // event handler
      function copy(e) {
  
      // find target element
      var 
        t = e.target,
        c = t.dataset.copytarget,
        inp = (c ? document.querySelector(c) : null);
  
      // is element selectable?
      if (inp &amp;&amp; inp.select) {
  
        // select text
        inp.select();
  
        try {
          // copy text
          document.execCommand('copy');
          inp.blur();
  
          // copied animation
          t.classList.add('copied');
          setTimeout(function() { t.classList.remove('copied'); }, 1500);
        }
        catch (err) {
          alert('please press Ctrl/Cmd+C to copy');
        }
  
      }
  
      }
  
  })();
  </code></pre>
  
  <p>When I write the code on localhost or upload to my server, it doesn't work. Pretty sure I'm copying it exactly.</p>
  
  <p><a href="http://loverant.com/bootstraptest/" rel="nofollow">http://loverant.com/bootstraptest/</a></p>
  
  <p>I'm new to coding so I'm probably just missing something really stupid.</p>