jQuery .focusout() Method

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

What Is .focusout()?

.focusout() is jQuery’s legacy shorthand for binding or triggering the bubbling focusout event — when an element or a descendant loses focus. Binding is deprecated since 3.3; modern code uses .on("focusout") / .trigger("focusout").

Remember
// Legacy (still works; bind form deprecated since 3.3)
$("p").focusout(function () {
  // this <p> or a nested input lost focus
});

// Modern replacements
$("p").on("focusout", handler);     // bind
$("p").trigger("focusout");         // fire handlers

// Better for dynamic forms (delegation)
$("#form").on("focusout", "input", handler);
NeedUse
New code (bind).on("focusout", fn)
New code (trigger).trigger("focusout")
Legacy bind.focusout(fn) ⚠ deprecated 3.3
Legacy trigger.focusout() (prefer .trigger)
Delegation.on("focusout", "input", fn) — not via .focusout()

How to Use .focusout()

Recognize the legacy API in old code, then migrate to .on() / .trigger().

  1. Bind with .focusout(handler) (legacy) or .on("focusout", handler) (preferred).
  2. Optionally pass eventData: .focusout(data, handler) → .on("focusout", data, handler).
  3. Trigger with no-arg .focusout() (legacy) or .trigger("focusout") (preferred).
  4. Bind on a parent to catch nested input leave (bubbling).
  5. For dynamic fields, use delegated .on("focusout", selector, fn) — not .focusout().
PieceRequired?Role
handlerFor bind formfunction(event) — runs on loss of focus (self or child)
eventDataOptional (1.4.3+)Extra data available as event.data
No-arg callFor triggerFires focusout on each matched element
Parent targetTypicalForm, paragraph, or wrapper around inputs

Pseudocode

Pseudocode
// Legacy
call parent.focusout(handler)
    → bind "focusout" on parent

when nested input loses focus:
    fire "focusout" on input
    event bubbles to parent
    call handler(event)

call parent.focusout()
    → trigger "focusout" on parent (handlers only)

// Modern
call parent.on("focusout", handler)
// or with delegation for dynamic fields:
call parent.on("focusout", "input", handler)

to migrate:
    .focusout(fn)      → .on("focusout", fn)
    .focusout(data, fn) → .on("focusout", data, fn)
    .focusout()        → .trigger("focusout")

Cheat Sheet

Quick map from the shorthand to modern APIs.

TopicDetail
Legacy bind$("p").focusout(handler) ⚠ deprecated 3.3
Modern bind$("p").on("focusout", handler)
Legacy trigger$("p").focusout()
Modern trigger$("p").trigger("focusout")
Unbind$("p").off("focusout" [, handler])
Since / status1.0 · eventData 1.4.3 · bind deprecated 3.3
Bubbles?Yes — unlike .blur() / blur
vs .blur().focusout() catches nested leave; .blur() does not
DelegationNot via .focusout() — use .on("focusout", "input", fn)

Live Preview

Leave nested fields. The form uses legacy .focusout(handler) (still available in jQuery 3.x).

You can also tab between the demo fields below.

Result
Ready — leave a field or pick an action.

jQuery Examples

Short, copy-ready snippets. Prefer .on("focusout") for new projects; these demos show the legacy API you will still meet in older code.

Example 1 — Basic .focusout(handler) on a Parent

Bind on a paragraph so nested inputs trigger the handler on leave.

jQuery
$("p").focusout(function () {
  var label = $(this).find("label").text() || "field";
  $("#out").text("focusout via .focusout(fn) — " + label.trim());
});
Try It Yourself

How It Works

  1. Bind. .focusout(fn) registers the callback on each <p>.
  2. Leave. Leaving a nested input fires focusout.
  3. Bubble. The event reaches the parent paragraph.
  4. Prefer. New code should use .on("focusout", fn).

Example 2 — .focusout(eventData, handler)

Pass metadata (since 1.4.3). Modern form: .on("focusout", data, fn).

jQuery
$("#profile").focusout({ form: "profile" }, function (event) {
  var name = $(event.target).attr("name") || "(container)";
  $("#out").text("form=" + event.data.form + " | left=" + name);
});
Try It Yourself

How It Works

  1. Data. The object becomes event.data.
  2. Bubble. Nested input leave reaches #profile.
  3. Target. event.target is the field that lost focus.
  4. Migrate. Replace with .on("focusout", { form: "profile" }, fn).

Example 3 — No-Arg .focusout() Trigger

Fire focusout from a button — runs bound handlers (does not move the caret).

jQuery
$("#box").focusout(function () {
  $("#out").text("focusout handler fired on #box.");
});

$("#fire").on("click", function () {
  $("#box").focusout(); // prefer .trigger("focusout")
});
Try It Yourself

How It Works

  1. Bind. The handler is registered on #box.
  2. Click. No-arg .focusout() triggers the event.
  3. Handlers. Bound focusout callbacks run immediately.
  4. Caret. To move focus away, use .trigger("blur") on an input.

Example 4 — Migrate to .on("focusout")

Both bind the same event — .on() is the recommended API for new code.

jQuery
$("#legacy").focusout(function () {
  $("#out").text("Legacy: .focusout(fn) — deprecated since 3.3.");
});

$("#modern").on("focusout", function () {
  $("#out").text("Modern: .on('focusout', fn) — use this for new code.");
});
Try It Yourself

How It Works

  1. Legacy. .focusout(fn) internally calls .on("focusout", fn).
  2. Modern. Bind directly with .on().
  3. Same event. Bubbling focusout behavior is unchanged.
  4. Bonus. Only .on() supports selector delegation.

Example 5 — .focusout() vs .blur() on a Parent

Prove that parent .blur() misses nested leave while .focusout() catches it.

jQuery
var log = [];
$("#wrapper").blur(function () {
  log.push("blur on wrapper (will NOT run)");
});
$("#wrapper").focusout(function () {
  log.push("focusout on wrapper (runs)");
  $("#out").text(log.join(" | "));
});
Try It Yourself

How It Works

  1. .blur. Non-bubbling — parent handler misses child leave.
  2. .focusout. Bubbling — parent handler runs.
  3. Log. Only the focusout message appears.
  4. Rule. Use focusout (or .on("focusout")) for parents.

Edge Cases & Pitfalls

Watch for these when reading or migrating legacy .focusout() code.

deprecated

Bind form deprecated since 3.3

Still works in jQuery 3.x, but new code should use .on("focusout").

delegation

No built-in delegation

.focusout(fn) cannot target future elements. Use $("#form").on("focusout", "input", fn).

trigger

No-arg .focusout() ≠ move caret

It runs handlers. To move keyboard focus away, call .trigger("blur") on a visible input.

bind vs trigger

.focusout(fn) ≠ .focusout()

With a function it binds; with no args it triggers. Always check the parentheses.

Browser Support

The underlying focusout event is a standard DOM event with bubbling. The .focusout() method is a jQuery API available since 1.0 (eventData since 1.4.3). Binding via .focusout(handler) is deprecated since 3.3 but still functional in jQuery 3.x.

✓ Deprecated · jQuery 3.3

jQuery .focusout()

Works in jQuery 1.x–3.x. Prefer .on('focusout') / .trigger('focusout') for new projects. Use parents to catch nested leave-focus.

100% With jQuery loaded
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
.focusout() Legacy API

Bottom line: Safe in legacy projects. Migrate bindings to .on('focusout') and triggers to .trigger('focusout') when you touch form scripts.

Performance Notes

ApproachCostBest for
One .on("focusout") on a formCheapMany nested fields, validation
Delegated .on("focusout", "input", fn)CheapDynamic / AJAX fields
Heavy work on every focusoutExpensiveAvoid — keep handlers light

The shorthand and .on("focusout") cost the same for a single bind. Prefer .on() for clarity and delegation. Keep leave callbacks light.

Key Takeaways

  • Role: legacy bind/trigger for bubbling focusout.
  • Migrate: .on("focusout", fn) and .trigger("focusout").
  • Parent bind: catches nested input leave (unlike .blur()).
  • Delegation: only available via .on("focusout", selector, fn).

One line: .focusout() is deprecated sugar for .on("focusout") / .trigger("focusout") — migrate when you touch the file.

Frequently Asked Questions

The .focusout() method has two roles. With a handler — .focusout(handler) or .focusout(eventData, handler) — it binds a function that runs when the matched element or any descendant loses focus (bubbles). With no arguments — .focusout() — it triggers the focusout event on each matched element. Binding has been part of jQuery since 1.0 and is deprecated since 3.3.
Yes. The binding signatures .focusout(handler) and .focusout(eventData, handler) are deprecated since jQuery 3.3. Use .on("focusout", handler) instead. The no-argument .focusout() trigger still works, but .trigger("focusout") is clearer. Legacy code continues to run in jQuery 3.x.
.focusout(handler) registers a callback and does not fire immediately. .focusout() with no arguments triggers the focusout event — the same as .trigger("focusout"). Check whether parentheses contain a function before reading legacy code.
Replace .focusout(fn) with .on("focusout", fn). Replace .focusout(data, fn) with .on("focusout", data, fn). Replace no-arg .focusout() with .trigger("focusout"). Cleanup with .off("focusout"). Under the hood, .focusout(handler) already delegates to .on("focusout").
.blur() binds or triggers the non-bubbling blur event on the matched element. .focusout() binds or triggers the bubbling focusout event — better for parent containers that validate when nested inputs lose focus. To move keyboard focus away, use .trigger("blur") on the current input.
No. Direct .focusout(fn) only binds to elements that already match. For dynamic fields, use .on("focusout", "input", fn) on a parent. That is one reason to prefer .on() over the shorthand.

Next: .blur() method

Learn the deprecated shorthand for bind/trigger blur — and how to migrate it.

.blur() 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.

9 people found this page helpful