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

<a id="alink" href="abc.aspx" style="visibility: hidden;">下一步</a> 

$("#alink").click(); // The click event of the a tag is triggered, but the page jump is not triggered 

document.getElementById("alink").click(); //Not only triggers the click event of the a tag, but also triggers the page jump 

 

Change "Next" to "<span id="spanId">Next</span>", that is, add an element that can be captured by jQuery to the text in the A tag, and then $("#spanId").click( ); to trigger the page jump.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326012718&siteId=291194637