jQuery .triggerHandler() Method

Beginner
6 min read
Updated: Oct 2026
5 examples
Live preview

What Is .triggerHandler()?

.triggerHandler() (since jQuery 1.2) runs handlers bound with jQuery for an event type on the first matched element. It is like .trigger(), but without bubbling, without native default actions, and with a handler return value instead of chaining.

Remember
$el.triggerHandler("click");                 // first element only
$el.triggerHandler("check", ["extra"]);      // + extra args
var result = $el.triggerHandler("validate"); // last handler return value

// vs .trigger():
// · no DOM bubbling
// · no native .focus() / .submit() side effects
// · does not return the jQuery object
NeedUse
Handlers only (no native / no bubble)$el.triggerHandler("…")
Full simulated event + bubble.trigger()
Attach handlers.on()
Remove handlers.off()
One-shot handler.one()

How to Use .triggerHandler()

Bind a handler with .on(), then call .triggerHandler() when you want that logic without side effects.

  1. Attach a handler with .on("event", fn) (or custom event name).
  2. Call .triggerHandler("event") on the element (first match only).
  3. jQuery runs direct handlers on that element — nothing bubbles up.
  4. Native defaults (focus, submit, …) are not invoked.
  5. Capture the return value if the handler returns something useful.
PieceRequired?Role
eventType / eventYesString (since 1.2) or jQuery.Event (since 1.3)
extraParametersNoArray or object passed after the event
TargetYesOnly the first matched element
Return value—Last handler’s return value, or undefined

Pseudocode

Pseudocode
call $(set).triggerHandler(eventType, extra?)

take first element in the set (ignore the rest)
if no element:
    return undefined

run jQuery handlers for eventType on that element
  (also on{eventType} if present on the element)
do NOT bubble to parents
do NOT call native element.eventType()

return value from the last handler that ran
  (or undefined if none ran)

Cheat Sheet

Keep these differences next to .trigger().

Topic.trigger().triggerHandler()
ElementsAll matchedFirst only
BubblingYesNo
Native defaultsMay runSkipped
ReturnjQuery objectHandler value / undefined
Since1.01.2 (Event arg 1.3)
Extra argsSupportedSupported

Live Preview

Run a custom check handler with .triggerHandler() and read its return value.

Handler returns "pass" if score ≥ 50, else "fail". No bubbling, no native side effects.

Result
Ready — set a score and click Run check.

jQuery Examples

Short, copy-ready snippets. Open DevTools, or use Try It Yourself for a live editor.

Example 1 — Focus: .trigger() vs .triggerHandler()

Official idea: both run the jQuery focus handler; only .trigger() may native-focus.

jQuery
$("input").on("focus", function () {
  $("#log").text("Focused!");
});

$("#old").on("click", function () {
  $("input").trigger("focus");        // handler + may native-focus
});

$("#new").on("click", function () {
  $("input").triggerHandler("focus"); // handler only
});
Try It Yourself

How It Works

  1. Bind. A jQuery focus handler updates the log.
  2. trigger. Runs handlers and may call the browser’s focus action.
  3. triggerHandler. Runs the same handlers without native focus.
  4. Use. Prefer triggerHandler when you want logic without moving focus.

Example 2 — Capture a Handler’s Return Value

Unlike .trigger(), you can read what the handler returned.

jQuery
$("#score").on("check", function () {
  var val = parseInt($(this).text(), 10);
  return val >= 50 ? "pass" : "fail";
});

$("#run").on("click", function () {
  var result = $("#score").triggerHandler("check");
  $("#log").text("Return value: " + result);
});
Try It Yourself

How It Works

  1. Custom event. check is a name you invent.
  2. Return. The handler returns "pass" or "fail".
  3. Capture. triggerHandler gives that value back to the caller.
  4. Branch. Use it for validation without touching the DOM defaults.

Example 3 — First Matched Element Only

.trigger() hits every match; .triggerHandler() hits only the first.

jQuery
$("button.item").on("click", function () {
  $("#log").append($(this).text() + " ");
});

$("#trigger-all").on("click", function () {
  $("button.item").trigger("click");           // all three
});

$("#trigger-first").on("click", function () {
  $("button.item").triggerHandler("click");    // Item 1 only
});
Try It Yourself

How It Works

  1. Set. Three buttons share the same click handler.
  2. trigger. Runs the handler on every matched button.
  3. triggerHandler. Stops after the first match.
  4. Loop tip. Use .each() if you need every element with triggerHandler.

Example 4 — No Event Bubbling

Parent handlers see .trigger() events, but not .triggerHandler().

jQuery
$("#child").on("click", function () {
  $("#log").append("Child. ");
});
$("#box").on("click", function () {
  $("#log").append("Parent. ");
});

$("#use-trigger").on("click", function () {
  $("#child").trigger("click");        // Child. Parent.
});
$("#use-handler").on("click", function () {
  $("#child").triggerHandler("click"); // Child.
});
Try It Yourself

How It Works

  1. Direct binds. Child and parent each have their own click handler.
  2. trigger. Event bubbles → parent runs too.
  3. triggerHandler. Stays on the child — parent never sees it.
  4. Delegated note. Handlers only on a parent (delegation) will not run via triggerHandler on the child.

Example 5 — Form Validation Without Native Submit

Dry-run a submit handler and read false / true without posting the form.

jQuery
$("form").on("submit", function () {
  var name = $("input[name='name']").val().trim();
  if (!name) return false;
  return true;
});

$("#test").on("click", function () {
  var ok = $("form").triggerHandler("submit");
  $("#log").text(ok === false ? "Validation failed" : "Validation passed");
});
Try It Yourself

How It Works

  1. Handler. Returns false when invalid, true when valid.
  2. Dry-run. triggerHandler("submit") does not call native .submit().
  3. Result. You branch on the returned value.
  4. Safety. Ideal for “test validation” buttons next to a real submit.

Edge Cases & Pitfalls

These differences surprise people coming from .trigger().

first

Only the first matched element

A multi-element set silently ignores everything after the first. Loop with .each() if needed.

bubble

No bubbling — delegated handlers miss it

Handlers bound on a parent with a child selector will not run. Bind directly on the target, or use .trigger().

return

Not chainable

Return value is the handler’s result. Do not write $el.triggerHandler("x").addClass(…).

empty

No handlers → undefined

An empty set or a missing handler returns undefined — check before treating it as true/false.

native

Native actions stay off

triggerHandler("submit") will not submit the form. That is the point — call native methods yourself if you need them.

Browser Support

.triggerHandler() has been part of jQuery since 1.2 (accepting a jQuery.Event since 1.3). It works in every browser that runs your loaded jQuery version.

✓ Stable · jQuery 1.2+

jQuery .triggerHandler()

Supported across jQuery 1.x, 2.x, and 3.x. Prefer a current jQuery 3.x build. Behavior differences vs .trigger() are intentional API design.

100% With jQuery
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
.triggerHandler() Universal

Bottom line: Safe for dry-runs and return-value checks. Remember: first element only, no bubble, no native defaults.

Performance Notes

ApproachCostBest for
triggerHandler on one nodeCheapValidation dry-runs, plugin hooks
trigger with bubblingSlightly moreWhen parents must react too
Many .each() + triggerHandlerHigherPrefer .trigger() if all matches need it

Cost is rarely the issue — pick the method for correct side effects. Use triggerHandler when you want isolation and a return value.

Key Takeaways

  • Role: run jQuery handlers only — no bubble, no native defaults.
  • Return: last handler value (or undefined) — not chainable.
  • Scope: first matched element only.
  • Pair: use .trigger() when you need bubbling or native behavior.

One line: .triggerHandler() is a quiet dry-run of handlers — first element, no bubble, return the result.

Frequently Asked Questions

.triggerHandler() executes jQuery handlers for an event on the first matched element only. Unlike .trigger(), it does not bubble, does not invoke native defaults (like form .submit()), and returns the last handler’s return value instead of the jQuery object.
.trigger() runs on all matched elements, bubbles, may invoke native behavior, and returns the jQuery object for chaining. .triggerHandler() affects only the first element, never bubbles, skips native side effects, and returns whatever the last executed handler returned (or undefined).
Use it when you only need jQuery handlers — without submitting a form, natively focusing an input, or firing parent handlers. Also use it when you need the handler’s return value for validation or branching.
No. It returns the value from the last handler that ran. If no handlers fire, it returns undefined. Example: var ok = $('#field').triggerHandler('validate') === true.
By design. To run handlers on every match, loop with .each() and call .triggerHandler() per element, or use .trigger() instead.
Yes. Same as .trigger(): .triggerHandler('custom', ['arg1', 'arg2']). Extra values arrive after the event object in the handler.

Next: .off() Method

Remove handlers attached with .on() — the modern unbind API.

.off() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful