title: Append URL parameter to href with JavaScript
body: <p>I'm trying to append a query string parameter to a href on a page using some JS:</p>
  
  <pre><code>var url = "http://www.sitetest.com?source=" + value;
  var element = document.getElementById('thislink');
  element.setAttribute("href",url);
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>&lt;a href="#" id="thislink"&gt;TEST THIS LINK&lt;/a&gt;
  </code></pre>
  
  <p>So whatever parameter is in the URL needs to append to the link, its working however it puts in the current URL not the one I specify in "var url"? Thanks!</p>
  
  <p>Live link here: <a href="http://partnerweb.moneycorp.com/test-js-get-url.html?pc=tmgppc5" rel="nofollow">http://partnerweb.moneycorp.com/test-js-get-url.html?pc=tmgppc5</a> </p>