title: Trigger Click event of anchor tag using jQuery
body: <p>I am trying to trigger the click event of an <code>a</code> tag using <code>jQuery</code> and have seen  many other Stack Overflow posts about this, but can't figure out why my replications of any of them are not working. My <code>HTML</code> is shown here:</p>
  <pre><code>        &lt;c:url var=&quot;link&quot; value=&quot;/hardwareItems&quot; /&gt;
          &lt;a href=&quot;${link}&quot;  id=&quot;goToHardwareItems&quot;&gt;Go
              to items&lt;/a&gt;
  </code></pre>
  <p>And then here is my <code>jQuery/JS</code>:</p>
  <pre><code>$(&quot;#form&quot;).on(&quot;submit&quot;, function() {
      if (confirm(&quot;Add hardware items?&quot;)){
          $(&quot;#goToHardwareItems&quot;).trigger('click');
      }
      
      else {
          window.location.href = &quot;/home&quot;;
      }
  });
  </code></pre>
  <p>What I have is not working though, but when I actually click on the link, I am indeed taken to the page. So the problem is that the event is simply not triggering, even though I am also getting into the <code>if</code> statement. What am I doing wrong?</p>