The jQuery ".triggerHandler ()" mechanism, unlike the ".trigger ()", only works with the first element referenced by the jQuery object for which it called. In other words,
$('.all-over-the-page').triggerHandler("readjust");
it will only call the readjust handler for the first element with the all-over-the-page class, even if there are many elements on the page with this class. On the other hand, the ".trigger ()" method will affect all of them.
I understand that I can use ".each ()" to get around this (or just write my own replacement that does this for me), but is there any justification for why the two are different in this regard? That doesn't make sense to me. (I understand, of course, that this almost certainly cannot be changed now.)
edit to clarify:
It is probably easier to understand why I am cracking my head over this if I provide the code-style context that I have. When I compiled code for various "widgets" on a page, this often included event handlers. A good example is a form that has received some fields whose relevance is controlled by a checkbox or radio button or selector. A common example of this is the โDelivery Addressโ box, which appears on zillion e-commerce sites: if checked, the delivery address is disabled and the billing address is used.
Now consider that some other code, for its own reasons, completely independent of the checkbox-control widget, really does things in a form that can include updating the checkbox settings programmatically. In this case, another widget code may use "triggerHandler ()" to report any widgets, "hey, I updated some things so you can re-check the current status and adjust if necessary."
Thus, if ".triggerHandler ()" works with all the selected elements, I could use:
$theForm.find('input, select, textarea').triggerHandler('change');
and all these handlers can work and do whatever they need. As I said, it's easy enough to write:
$theForm.find('input, select, textarea').each(function() { $(this).triggerHandler('change'); });