title: simulate a click on link using jquery not working
body: <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("#foo").on("click", function (event) {
    alert($(this).text());
  });
  
  $("#foo").trigger("click");</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;a id="foo" class="fancybox.iframe btn btn-primary" href="addDepartment.jsp" &gt;Next Page&lt;/a&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>when the page is loaded alert box shows the "Next Page" , but fancybox doesn't open up .<br>
  If I physically click on that button(link) then it is working fine.</p>