.trigger(eventType [, extraParameters]) executes handlers (and related behaviors) for an event on the matched elements (since 1.0). Since 1.3 you can also pass a jQuery.Event object; triggered events bubble.
Remember
$("#foo").on("click", function () {
alert($(this).text());
});
$("#foo").trigger("click"); // run that handler now
// Custom event + extra args
$("#foo").on("custom", function (event, a, b) {
alert(a + " / " + b);
});
$("#foo").trigger("custom", ["Custom", "Event"]);
Bind first with .on(), then fire the same event type when you need to.
Attach handlers with .on() (or a shortcut like .click()).
Call .trigger("click") (or another type) on the element.
Optional: pass extra data as an array/object for the handler.
Optional: build a jQuery.Event and inspect isDefaultPrevented() afterward.
Use .triggerHandler() if you must avoid bubbling and native defaults.
Form
Since
Role
.trigger(eventType [, extra])
1.0
Fire by event name string
.trigger(event [, extra])
1.3
Fire a jQuery.Event object
Pseudocode
Pseudocode
for each matched element:
create / use event object for EVENT_TYPE
run jQuery handlers in bind order
handler(event, EXTRA…)
allow bubbling (since 1.3) unless stopped
may invoke related native behavior
vs triggerHandler:
first element only
no bubble
no native default
Reference
Cheat Sheet
Keep these differences straight while wiring events.
Topic
Detail
Returns
jQuery (chainable)
Since
1.0 · Event object 1.3 · bubbles 1.3
Extra args
After event in the handler
vs event.data
Bind-time data from .on(); trigger extras are fire-time
Custom events
Any name you bind with .on()
vs .triggerHandler()
Handler-only, first element, no bubble/default
Try it
Live Preview
Trigger a click, a custom event, or pass extra parameters — no mouse required.
Handlers are already bound — pick an action and click Run.
Log
Ready — pick an action and click Run.
Code
jQuery Examples
Short, copy-ready snippets. Bind with .on(), then fire with .trigger().
Trigger. Child handler runs, then the event can reach parent.
TriggerHandler. Only the child’s handlers run — no bubble.
Defaults..triggerHandler() also skips native default actions.
Pick. Use handler-only when native side effects are unwanted.
Edge Cases & Pitfalls
Watch for these when firing events in code.
native
Not a perfect user-event clone
Handlers run, but browser quirks of a real interaction may differ — especially for focus/submit.
methods
Matching property methods may run
If an event name matches an object property (and default is not prevented), jQuery may try to call it as a method — use .triggerHandler() to avoid that.
data
Trigger extras ≠ .on() eventData
Bind-time event.data is fixed when you attach; trigger extras are chosen when you fire.
one
.trigger() spends a .one() shot
Programmatic fire counts as the first invocation for one-shot handlers.
Compatibility
Browser Support
.trigger() has been part of jQuery since 1.0 (Event-object form and bubbling since 1.3). It works wherever your loaded jQuery version runs.
✓ Stable · jQuery 1.0+
.trigger()
Works in every browser that runs your loaded jQuery version. Prefer a current jQuery 3.x build for modern projects.
100%With jQuery events
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
.trigger()Universal
Bottom line: Production-ready. Pair with .on() for custom events; use .triggerHandler() when native defaults must not run.
Analysis
Performance Notes
Approach
Cost
Best for
Occasional .trigger()
Low
Tests, UI wiring, custom events
Trigger inside tight loops
Higher
Call shared functions directly instead
Deep bubbling trees
Higher
Stop propagation when done; prefer closer roots
Triggering is fine for intentional signals. If you only need shared logic, a plain function call is cheaper than synthesizing an event.
Remember
Key Takeaways
Role: programmatically run event handlers on matched elements.
Extras: pass fire-time args after event in the handler.
Custom: bind any name with .on(), fire it with .trigger().
Safer native: use .triggerHandler() to skip bubble and defaults.
One line:.trigger() fires bound handlers on demand — native or custom — with optional extra arguments.
Frequently Asked Questions
.trigger() runs handlers attached for an event type on the matched elements. It synthesizes an event (and can bubble since 1.3) so you can fire clicks, submits, or custom events without a real user action.
.trigger() affects all matched elements, bubbles, and may invoke native behaviors. .triggerHandler() runs handlers on only the first matched element, does not bubble, and skips native default actions.
Pass extra parameters as the second argument: .trigger("custom", ["a", "b"]). They arrive after the event object in the handler. That is different from eventData given to .on() at bind time.
Yes. Bind with .on("myEvent", fn) and fire with .trigger("myEvent") or .trigger("myEvent", [extra]). Useful for component messaging without native DOM event types.
No. It runs jQuery handlers in order with a synthesized event object, but it does not perfectly replicate every browser detail of a natural user event.
When you want jQuery handlers only — no bubbling and no native default (for example, avoiding a real form submit or focus side effects).