开发者

how do I tell if an event is fired by .click() or by the user?

I want to differentiate actual mouse clicks fro开发者_开发百科m script generated clicks.How can i do it with jquery?


You could check for something that isn't included in a triggered event object.

$('div').click(function(e) {
    if ( e.originalEvent ) {
        console.log('actual mouseclick');
    }
}).trigger('click');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜