.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);
Call
What it does
handler
function(event) — runs on loss of focus (self or child)
eventData
Extra data available as event.data
No-arg call
Fires focusout on each matched element
Parent target
Form, paragraph, or wrapper around inputs
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Bind with .focusout(handler) (legacy) or .on("focusout", handler) (preferred).
Click #fire → no-arg .focusout() runs
Bound handler updates #out
Keyboard focus may stay on the button
How It Works
Bind. The handler is registered on #box.
Click. No-arg .focusout() triggers the event.
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.