开发者

jQuery: receive extraParameters from triggerHandler()

   $('<span>test</span>')
    .change(function(e){console.log(e.da开发者_运维百科ta);})
    .triggerHandler('change',{foobar:1});

I'm doing it wrong or it's bugged?

Thanks ;)


The extra data is passed as argument to the handler:

$('<span>test</span>')
.change(function(e, data){console.log(data);})
.triggerHandler('change',{foobar:1});

The documentation also says that it has to be an array, though it works with one object too.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜