Why is triggerHandler only affecting the first one on the list?

0

I'm trying to call the handler of an event via jquery, while the triggerHandler method is only affecting one of the selected elements, and the selector definitely represents multiple elements.

jsfiddle

The triggerHandler is called within the event of a check-box to change the values of several other check-boxes, with the same value of it. Setting the 'checked' property for all other check-boxes works, however the triggerHandler does not.

What am I doing wrong?

    
asked by anonymous 13.03.2014 / 21:20

1 answer

2

Actually I believe you are not wrong exactly. What happens is that jQuery.fn.triggerHandler really only triggers the event to the first node.

In your case would not the use of jQuery.fn.trigger apply?

Maybe something like this:

$('.foo').trigger('change');
    
13.03.2014 / 21:23