$('a').trigger('click'); not working

后端 未结 9 2440
南旧
南旧 2021-02-19 04:06

How do I make jquery click test



        
9条回答
  •  梦如初夏
    2021-02-19 05:10

    If your intention is to navigate to the specified URL as if the user had clicked the link try calling the DOM .click() method instead of the jQuery .click() method:

    $('#mylink')[0].click();
    

    The jQuery .click() will call event handlers that you've bound but not cause the default click behaviour.

提交回复
热议问题