JQuery 2.1 trigger extraParameters not working

Why not pass additional parameters, as it should be in accordance with the documentation?

The same code works correctly jQuery 1.8

<input type="checkbox" name="test" value="qqq">

$('input[value="qqq"]').on('click', function(event, data){
    alert(data);
});

$('input[value="qqq"]').trigger('click', ['QQQ']);

An example of working behavior in jQuery 1.8: http://jsfiddle.net/kbr6h11z/1/

UPD1: My solution to this problem:

$('input[value="qqq"]').on('click', function(event, data){
    alert(data);
    if (data!= null) $(this).prop('checked', !$(this).prop('checked'));
});

$('input[value="qqq"]').triggerHandler('click', ['QQQ']);
+4
source share
1 answer

You should use the change event instead of click.

$('input[value="qqq"]').on('change', function(event, data){
    alert(data);
});
$('input[value="qqq"]').trigger('change', ['QQQ']);
+1
source

All Articles