jQuery Focusout Event

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

What Is the focusout Event?

The focusout event fires when an element or any element inside it loses focus. Unlike blur, focusout bubbles — so one handler on a parent form can validate every nested input when the user leaves it.

Remember
// Parent form — one handler for all inputs
$("#form").on("focusout", "input", function () {
  // a nested input lost focus
});

// blur does NOT bubble; focusout does
$("#wrapper").on("blur", fn);      // misses child blur
$("#wrapper").on("focusout", fn);  // runs for child blur

// Pair with focusin for enter/exit
$("#form").on("focusin", "input", enterFn);
NeedUse
One handler for a form.on("focusout", "input", fn)
Single field only.on("blur", fn)
Gain focus (bubbling).on("focusin", …)
Trigger handlers.trigger("focusout")
Move focus away.trigger("blur") on the input

How to Use focusout

Bind on a parent, filter with a selector, and react when any nested field loses focus.

  1. Bind with .on("focusout", handler) on a parent, or .on("focusout", "input", handler) for delegation.
  2. Optionally pass eventData: .on("focusout", data, handler).
  3. Inside the handler, use event.target or $(this) (delegated) for the field that lost focus.
  4. Pair with focusin when you need enter and exit on the same parent.
  5. To move keyboard focus away, call .trigger("blur") on the input — not only focusout.
PieceRequired?Role
Parent elementYesContainer that listens (form, div, paragraph)
Selector filterOptional"input", "textarea", etc. for delegation
handlerFor bindfunction(event) — runs on loss of focus
eventDataOptionalExtra data available as event.data

Pseudocode

Pseudocode
call parent.on("focusout", "input", handler)
    → store delegated handler on parent

when user leaves a nested input:
    fire "blur" on the input (does not bubble)
    fire "focusout" on the input
    focusout bubbles → reaches parent
    if target matches "input":
        call handler(event)
        this → the input (delegated)

call parent.on("blur", handler)
    → never runs for nested input blur
      (blur does not bubble)

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

Cheat Sheet

Keep these facts handy when wiring leave-focus UX on forms.

TopicDetail
Bind$("#form").on("focusout", "input", handler)
Trigger$("#el").trigger("focusout")
Unbind$("#form").off("focusout" [, handler])
Bubbles?Yes — unlike blur
vs blurSame idea; focusout bubbles to parents
vs focusinLose vs gain; both bubble
Since.on("focusout") 1.7 · .trigger("focusout") 1.0
Legacy shorthand.focusout() ⚠ deprecated for binding since 3.3
Delegated blur.on("blur", "input", fn) uses focusout under the hood

Live Preview

Tab out of nested fields. The form listens with .on("focusout", "input", …) — one handler covers every input.

You can also tab between the demo fields below.

Result
Ready — leave a field or pick an action.

jQuery Examples

Short, copy-ready snippets based on the official jQuery API idea — listen on a parent when nested controls lose focus.

Example 1 — focusout vs blur on a Parent

Official idea: count both events on a paragraph — only focusout increments for nested leave.

jQuery
var focusout = 0, blur = 0;
$("p")
  .on("focusout", function () {
    focusout++;
    $("#out").text("focusout: " + focusout + "x | blur: " + blur + "x");
  })
  .on("blur", function () {
    blur++;
    $("#out").text("focusout: " + focusout + "x | blur: " + blur + "x");
  });
Try It Yourself

How It Works

  1. Bind both. The paragraph listens for focusout and blur.
  2. Leave. Tabbing out of a nested input fires both events on the input.
  3. Bubble. Only focusout reaches the paragraph.
  4. Count. The focusout counter increases; blur on <p> does not.

Example 2 — Delegated Validation on Leave

One handler on the form checks required fields when the user exits them.

jQuery
$("#signup-form").on("focusout", "input", function () {
  var name = $(this).attr("name") || "(unnamed)";
  var empty = $(this).val().trim().length === 0;
  $("#out").text(
    empty ? name + " is empty — please fill it in." : name + " looks OK."
  );
});
Try It Yourself

How It Works

  1. Parent. The handler lives on #signup-form.
  2. Leave. Exiting any matching input fires focusout.
  3. Check. Read $(this).val() for a simple empty test.
  4. Message. Status text guides the user to fix the field.

Example 3 — blur vs focusout on a Wrapper

Prove that parent blur stays silent while focusout runs.

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

How It Works

  1. blur. Does not bubble — parent handler misses child leave.
  2. focusout. Bubbles — parent handler runs.
  3. Log. Only the focusout message appears.
  4. Rule. Use focusout (or delegated blur) for parents.

Example 4 — eventData with Delegated focusout

Pass shared metadata into every delegated leave callback.

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

How It Works

  1. Data. The object becomes event.data.
  2. Delegate. The selector still matches the left input.
  3. Read. Combine event.data with $(this).attr("name").
  4. Reuse. One object serves every field in the form.

Example 5 — Pair focusin and focusout

Track enter and leave on the same form with two bubbling handlers.

jQuery
$("#signup-form")
  .on("focusin", "input", function () {
    $("#out").text("Entered: " + $(this).attr("name"));
  })
  .on("focusout", "input", function () {
    $("#out").text("Left: " + $(this).attr("name"));
  });
Try It Yourself

How It Works

  1. Enter. focusin updates the status when a field is entered.
  2. Leave. focusout updates it when the field is left.
  3. Same parent. Both handlers live on the form.
  4. UX. Ideal for hints on enter and validation on leave.

Edge Cases & Pitfalls

Check these before relying on parent-level leave-focus handlers.

blur

Parent blur will miss children

blur does not bubble. Use focusout (or delegated .on("blur", "input", fn)).

trigger

.trigger("focusout") ≠ move focus

It runs handlers. To move the caret away, call .trigger("blur") on the input or focus another field.

pair

Pair with focusin

Show hints on focusin and validate on focusout so helpers and errors stay in sync.

shorthand

.focusout(handler) is deprecated

Prefer .on("focusout", handler). The shorthand bind form is deprecated since jQuery 3.3.

Browser Support

The focusout event is a standard DOM event with bubbling. Bind with .on("focusout") since jQuery 1.7; .trigger("focusout") has existed since 1.0. jQuery has long used focusout for delegated blur (since 1.4.2).

✓ jQuery 1.7+

jQuery focusout event

Supported in all browsers jQuery targets. Prefer .on('focusout') for parent forms. Pair with focusin. Native equivalent: element.addEventListener('focusout', fn).

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 Excellent

Bottom line: Safe for modern and legacy jQuery projects. Use focusout whenever a parent must react to nested leave-focus — including dynamic fields and validation.

Performance Notes

ApproachCostBest for
One delegated focusout on a formCheapMany / dynamic fields, validation
Direct .on("blur") per fieldCheapFew static inputs
Heavy work on every focusoutExpensiveAvoid — keep handlers light

Delegation usually wins for forms: one listener instead of N. Keep leave handlers small — validate one field, update a short message.

Key Takeaways

  • Role: bubbling leave-focus — parents can listen for nested blur.
  • API: .on("focusout", "input", fn) on the form.
  • vs blur: same idea, but blur does not bubble.
  • Pair: use focusin for enter, focusout for leave.

One line: use focusout when a parent form must react to nested leave-focus — including validation and dynamic fields.

Frequently Asked Questions

The focusout event fires when an element loses focus, or when any element inside it loses focus. Unlike blur, focusout bubbles up the DOM — so you can bind one handler on a parent form and validate when the user leaves any nested input. Bind with .on("focusout", handler) since jQuery 1.7.
Both relate to losing focus. blur fires only on the element that lost focus and does not bubble. focusout fires on that element and bubbles to ancestors — ideal for event delegation on forms. Use blur for single-field handlers; use focusout when one parent handler should cover all inputs.
Yes. Native focusout bubbles from the element that lost focus up through parents. That is why .on("focusout", "input", fn) on a form works. Since 1.4.2, jQuery also maps delegated .on("blur", "input", fn) to focusout internally.
They are opposites and both bubble. focusin fires when an element or its descendant gains focus. focusout fires when an element or its descendant loses focus. Pair them on a parent container for enter/exit tracking and validation.
Call .trigger("focusout") to run bound focusout handlers. To actually move keyboard focus away, tab elsewhere or call .trigger("blur") on the current input. Use .triggerHandler("focusout") to run handlers without side effects.
Prefer .on("focusout", handler) and .trigger("focusout"). The .focusout() shorthand binding form is deprecated since jQuery 3.3. See the .focusout() method tutorial for migration details.

Next: .focusout() method

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

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