Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery: receive extraParameters from triggerHandler()

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

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

Thanks ;)

like image 654
Somebody Avatar asked Jun 14 '11 18:06

Somebody


1 Answers

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.

like image 167
Felix Kling Avatar answered Sep 28 '22 01:09

Felix Kling