Use JS or jQuery to simulate the mouse click on the a tag event code

  • 2020-03-30 02:20:59
  • OfStack

 
<a id="alink" href="abc.aspx" style="visibility: hidden;"> The next step </a> 
$("#alink").click(); //Triggered a click on the a TAB, but did not trigger a page jump
document.getElementById("alink").click(); //Both triggered the click event of the a tag and the page jump

Replace "next" with "< Span id = "spanId" > The next step < / span>" $("#spanId").click(); , to trigger a page jump.

Related articles: