Why is triggerHandler only affecting the first on the list?

Asked

Viewed 54 times

0

I’m trying to call Handler an event via jquery, by using the method triggerHandler is only affecting one of the selected elements, and the selector definitely represents several elements.

jsfiddle

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

What I’m doing wrong?

1 answer

2


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

In your case the use of jQuery.fn.trigger?

Maybe something like this:

$('.foo').trigger('change');
  • If it does... something in my mind said that trigger("change") would cause the checkbox to switch status, as if I were simulating the change.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.