You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Note the difference between the extra parameters passed here and the <code>eventData</code> parameter to the <ahref="/on/">.on()</a> method. Both are mechanisms for passing information to an event handler, but the <code>extraParameters</code> argument to <code>.trigger()</code> allows information to be determined at the time the event is triggered, while the <code>eventData</code> argument to <code>.on()</code> requires the information to be already computed at the time the handler is bound.</p>
46
46
<p>The <code>.trigger()</code> 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. </p>
47
47
<divclass="warning"><strong>Note:</strong> For both plain objects and DOM objects other than <code>window</code>, 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 <code>event.preventDefault()</code>. If this behavior is not desired, use <code>.triggerHandler()</code> instead.</div>
48
+
<divclass="warning"><strong>Note:</strong> As with <code>.triggerHandler()</code>, when calling <code>.trigger()</code> with an event name matches the name of a property on the object, prefixed by <code>on</code> (e.g. triggering <code>click</code> on <code>window</code> that has a non null <code>onclick</code> method), jQuery will attempt to invoke that property as a method.</div>
48
49
</longdesc>
49
50
<example>
50
51
<desc>Clicks to button #2 also trigger a click for button #1.</desc>
0 commit comments