How to simulate a click with JavaScript?

前端 未结 8 1973
说谎
说谎 2020-11-22 01:49

I\'m just wondering how I can use JavaScript to simulate a click on an element.

Currently I have:



        
8条回答
  •  无人及你
    2020-11-22 02:00

    Have you considered using jQuery to avoid all the browser detection? With jQuery, it would be as simple as:

    $("#mytest1").click();
    

提交回复
热议问题