From c544fdb16d7b9e79ed674a2069fd723eb657629b Mon Sep 17 00:00:00 2001
From: Arthur Verschaeve The .trigger()
method can be used on jQuery collections that wrap plain JavaScript objects similar to a pub/sub mechanism; any event handlers bound to the object will be called when the event is triggered. window
, if a triggered event name matches the name of a property on the object, jQuery will attempt to invoke the property as a method if no event handler calls event.preventDefault()
. If this behavior is not desired, use .triggerHandler()
instead..triggerHandler()
, when calling .trigger()
with an event name matches the name of a property on the object, prefixed by on
(e.g. triggering click
on window
that has a non null onclick
method), jQuery will attempt to invoke that property as a method.length
property, you should pass the object in an array (e.g. [ { length: 1 } ]
).