title: JavaScript Clipboard app not working, need assistance
body: <pre><code>    &lt;!DOCTYPE html&gt;
      &lt;head&gt;
          &lt;title&gt; Query to Clipboard JS Applet by Damien Lesser &lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;script type='text/javascript'&gt;
      function getQueryVariable(variable)
      {
      var query = window.location.search.substring(1);
      var vars = query.split(&quot;&amp;&quot;);
      for (var i=0;i&lt;vars.length;i++) {
             var pair = vars[i].split(&quot;=&quot;);
             if(pair[0] == variable){return pair[1];}
      }
      return(false);
      }
      if getQueryVariable('list') === null{
      var clip = getQueryVariable('clip')
      } else{
      //Nothing
      };
      function copyStringToClipboard (str) {
      // Create new element
      var el = document.createElement('textarea');
      // Set value (string to be copied)
      el.value = clip;
      // Set non-editable to avoid focus and move outside of view
      el.setAttribute('readonly', '');
      el.style = {position: 'absolute', left: '-9999px'};
      document.body.appendChild(el);
      // Select text inside element
      el.select();
      el.setSelectionRange(0, 99999); /* For mobile devices */
      // Copy text to clipboard
      document.execCommand('copy');
      // Remove temporary element
      document.body.removeChild(el);
      };
      copyStringToClipboard(clip);
      var alert1 = 'copied '
      var alert2 = ' to clipboard successfully'
      console.log(alert1.concat(clip.concat(alert2)));
      var para = document.createElement('p');
      para.innerHTML = 'Copied successfully!'
      &lt;/script&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  <p>As you have probably guessed, I am new to JavaScript, and I am trying to make a tool that allows developers to open a url with a query string, for the query to then be used for the clipboard, in those few niche cases where you can’t use other methods, or don’t have enough experience. It is supposed to happen automatically, but it produces no results.
  If you would like to test it out, or use this tool once I have completed development, just go to <a href="https://querytoclip.netlify.app/" rel="nofollow noreferrer">https://querytoclip.netlify.app/</a></p>
  <p>and then add ‘?clip=’ (without quotes)
  Beyond what I have asked for so far, it would be nice if someone could make my code more efficient, because I am no wizard...</p>