title: copy text to clipboard using .select() getting Uncaught TypeError
body: <p>I'm trying to follow this code:   <a href="https://www.w3schools.com/howto/howto_js_copy_clipboard.asp" rel="nofollow noreferrer">https://www.w3schools.com/howto/howto_js_copy_clipboard.asp</a></p>
  
  <p>HTML Modal:</p>
  
  <pre><code>&lt;div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"&gt;
        &lt;div class="modal-dialog" role="document"&gt;
          &lt;div class="modal-content"&gt;
            &lt;div class="modal-header"&gt;
              &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;
              &lt;h4 class="modal-title" id="myModalLabel"&gt;App Link&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class="modal-body"&gt;
              &lt;input id="appID" value="123"&gt;&lt;/input&gt;
              &lt;button type="button" class="btn btn-success" id="copyBtn"&gt;Copy&lt;/button&gt;
              &lt;/div&gt;                  
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Here's my JS: </p>
  
  <pre><code>var copyBtn = document.getElementById('copyBtn');
  
  copyBtn.onclick = function(){
      var myCode = document.getElementById('appID').value;
      var fullLink = document.createElement('input');
      document.body.appendChild(fullLink);
      fullLink.value = "http://fulllink/" + myCode;
      fullLink.select();
      document.execCommand("copy", false);
      fullLink.remove();
      alert("Copied the text: " + fullLink.value);
  }
  </code></pre>
  
  <p>Code will not work when input and button are inside the modal; code will work if placed in the body. Why?</p>