jQuery .focusout() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Form Events

Definition

.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").

Syntax

Start with these common calls. Keep them short and readable.

jQuery
// 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);
CallWhat it does
handlerfunction(event) — runs on loss of focus (self or child)
eventDataExtra data available as event.data
No-arg callFires focusout on each matched element
Parent targetForm, paragraph, or wrapper around inputs

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Bind with .focusout(handler) (legacy) or .on("focusout", handler) (preferred).
Step 2Optionally pass eventData: .focusout(data, handler) → .on("focusout", data, handler).
Step 3Trigger with no-arg .focusout() (legacy) or .trigger("focusout") (preferred).

Return Value

Return ValueDescription
jQuery objectMost setters and traversing helpers return the jQuery collection so you can chain more methods.

jQuery Examples

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.

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.

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.

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() Method tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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