可以使用trigger或者triggerHandler函数,比如设置取得焦点事件
$("input").trigger( "focus" ); $("input").triggerHandler( "focus" );
触发点击事件不能这样写:
$('#targetEl').click();
这样也不行
$("#targetEl").trigger( "click" );
正确的写法应该是下面这样:
$('#targetEl')[0].click()
摘自:
https://www.runoob.com/try/try.php?filename=tryjquery_event_triggerhandler_trigger1
https://blog.csdn.net/qq_20315217/article/details/122982968
标签:jquery,控件,触发,targetEl,点击,trigger,click From: https://www.cnblogs.com/rdchen/p/17130599.html