Click on element via Javascript console

前端 未结 5 977
青春惊慌失措
青春惊慌失措 2021-02-07 06:28

Imagine there is an element #button1 on website which is watched by jQuery:

$(\'#button1\').click(function(){
   console.log(\"you clicked\");
};
<         


        
5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-07 07:08

    You can not click, but simulate or trigger click. Please refer Creating and triggering events

提交回复
热议问题