jQuery Focusout Event

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

Definition

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.

Syntax

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

jQuery
// 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);
CallWhat it does
Parent elementContainer that listens (form, div, paragraph)
Selector filter"input", "textarea", etc. for delegation
handlerfunction(event) — runs on loss of focus
eventDataExtra data available as event.data

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

Parameters

ParameterDescription
Step 1Bind with .on("focusout", handler) on a parent, or .on("focusout", "input", handler) for delegation.
Step 2Optionally pass eventData: .on("focusout", data, handler).
Step 3Inside the handler, use event.target or $(this) (delegated) for the field that lost focus.

Return Value

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

jQuery Examples

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.

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.

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.

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