title: How to add value on URL using <a href> when it got clicked using javascript
body: <p>so I have four links with different Href for example</p>
  <pre><code>&lt;a href=&quot;markmendoza.com/123&quot;&gt;
  &lt;a href=&quot;markmendoza.com/555&quot;&gt;
  &lt;a href=&quot;markmendoza.com/666&quot;&gt;
  &lt;a href=&quot;markmendoza.com/999&quot;&gt;
  </code></pre>
  <p>and I wanted to manipulate the href when it got clicked by adding some more value</p>
  <p>when it get click it will be:</p>
  <pre><code>
      markmendoza.com/123/?Sample
      markmendoza.com/555/?Sample
      markmendoza.com/666/?Sample
      markmendoza.com/999/?Sample
  
  </code></pre>
  <p>I got here my code</p>
  <pre><code>
      let a = document.querySelectorAll('a');
       for (let i = 0; i &lt; a.length; i++) {
        a[i].addEventListener(&quot;click&quot;, function(event) {
          event.target.href = event.target.href + '/?Sample';
        }
  
  </code></pre>
  <p>its adding fine but once you click it many times it just adds the <strong>/?Sample</strong> on the end of the link again and again so if I clicked the link 10x it will be <strong>markmendoza.com/123/?Sample?Sample?Sample?Sample?Sample?Sample?Sample</strong></p>