jQuery Focusout Event

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Form events

What You’ll Learn

The focusout event fires when an element loses focus — or when any element inside it loses focus. Unlike blur, it bubbles up the DOM, so one handler on a parent form can validate every nested input when the user tabs away. This tutorial covers .on("focusout"), eventData, delegation, comparison with blur and focusin, and the official jQuery focusout vs blur demo.

01

.on()

Bind handler

02

Bubbles

Parent forms

03

Delegate

Dynamic inputs

04

vs blur

No bubble

05

focusin

Enter pair

06

Since 1.7

Modern API

Introduction

Validating every field in a large form is tedious if you bind .on("blur", fn) on each input individually. The focusout event solves this: it fires when an element loses focus or when any descendant loses focus, and it bubbles up to parent nodes.

The official jQuery API recommends pairing focusout with focusin for enter/exit tracking on containers. Bind with .on("focusout") since 1.7. jQuery also uses focusout internally when you delegate .on("blur", "input", fn) since 1.4.2.

Understanding the focusout Event

The focusout event is sent to an element when it loses focus, or when any element inside of it loses focus. This is distinct from the blur event: blur fires only on the element that lost focus and does not bubble; focusout bubbles so parent containers can listen once for all nested fields.

When a user tabs out of an input inside a <form>, the browser fires blur on the input and focusout on the input, the form, and every ancestor up to the document. jQuery’s .on("focusout", "input", fn) on the form catches every current and future input without rebinding.

💡
Beginner Tip

Pair focusin with focusout on the same parent: highlight the active field on .on("focusin", "input", fn), validate on .on("focusout", "input", fn). To actually move keyboard focus away programmatically, call .trigger("blur") on the current input — that fires both blur and focusout in the browser.

📝 Syntax

The modern jQuery API for the focusout event has two main forms — binding a handler and triggering the event:

1. Bind a handler — .on("focusout" [, eventData ], handler) (since 1.7)

jQuery
.on( "focusout" [, eventData ], handler )
  • eventData — optional object passed to the handler as event.data.
  • handler — function called each time focusout fires: function( event ) { ... }.

2. Event delegation — .on("focusout", selector, handler)

jQuery
$( "#form" ).on( "focusout", "input", function( event ) {
  // jQuery maps blur to focusout for delegation since 1.4.2
} );

Native blur does not bubble. jQuery’s delegated .on("blur", "input", fn) works because jQuery maps it to the bubbling focusout event internally since 1.4.2. Binding .on("focusout", ...) directly makes the bubbling behavior explicit in your code.

3. Trigger the event — .trigger("focusout") (since 1.0)

jQuery
.trigger( "focusout" )
  • Runs bound focusout handlers on the matched element.
  • To move keyboard focus away, use .trigger("blur") — the browser fires both blur and focusout.
  • Use .triggerHandler("focusout") to run handlers without bubbling side effects.

4. Unbind — .off("focusout" [, selector] [, handler])

jQuery
$( "#target" ).off( "focusout" );              // remove all focusout handlers
$( "#form" ).off( "focusout", "input", fn );   // remove delegated handler

Official jQuery API example

jQuery
var focusout = 0, blur = 0;

$( "p" )
  .on( "focusout", function() {
    focusout++;
    $( "#focus-count" ).text( "focusout fired: " + focusout + "x" );
  } )
  .on( "blur", function() {
    blur++;
    $( "#blur-count" ).text( "blur fired: " + blur + "x" );
  } );

Return value

  • .on() and .trigger() return the original jQuery object for chaining.
  • Handler return values are ignored unless you use return false (equivalent to preventDefault() + stopPropagation()).

⚡ Quick Reference

GoalCode
Bind focusout on parent$("#form").on("focusout", fn)
Delegated focusout on inputs$("#form").on("focusout", "input", fn)
Move focus away$("#login").trigger("blur")
Run focusout handlers only$("#form").trigger("focusout")
Run handlers without bubbling$("#form").triggerHandler("focusout")
Remove focusout handlers$("#form").off("focusout")
Non-bubbling alternative$("#email").on("blur", fn)
Enter pair (bubbles)$("#form").on("focusin", "input", fn)

📋 focusout vs blur vs focusin vs delegated blur

Four related APIs — pick bubbling vs non-bubbling and the right enter/exit pair for parent forms.

focusout
bubbles

Fires when element or descendant loses focus — one handler on a parent covers all nested inputs

blur
no bubble

Fires only on the element that lost focus — best for single-field handlers on that input directly

focusin
bubbles

Opposite of focusout — fires when element or descendant gains focus; pair for enter/exit UX

.on("blur", sel)
delegate

jQuery maps delegated blur to focusout since 1.4.2 — same result, different event name

Examples Gallery

Example 1 is the official jQuery API focusout vs blur demo. Examples 2–5 cover form validation, blur vs focusout bubbling, eventData, and pairing focusin with focusout. Use the Try-it links to run each snippet in the browser.

📚 Binding & Triggering

Official jQuery demos for focusout handlers and the blur comparison.

Example 1 — Official Demo: focusout vs blur on Paragraphs

Watch for focus loss inside paragraphs — the focusout counter increases but the blur counter does not, because blur does not bubble.

jQuery
var focusout = 0, blur = 0;

$( "p" )
  .on( "focusout", function() {
    focusout++;
    $( "#focus-count" ).text( "focusout fired: " + focusout + "x" );
  } )
  .on( "blur", function() {
    blur++;
    $( "#blur-count" ).text( "blur fired: " + blur + "x" );
  } );
Try It Yourself

How It Works

The handler binds on <p>, not the input. When the nested input loses focus, focusout bubbles to the paragraph. blur fires only on the input itself — the paragraph’s blur handler never runs.

Example 2 — Delegated focusout Validation on a Form

One handler on #signup-form marks empty fields when the user tabs away.

jQuery
$( "#signup-form" ).on( "focusout", "input", function() {
  var $field = $( this );
  var empty = $field.val().trim().length === 0;
  $field.toggleClass( "required-missing", empty );
} );
Try It Yourself

How It Works

focusout bubbles from the input to the form. jQuery’s selector filter "input" ensures $(this) is the field that lost focus, not the form element.

📈 Bubbling & Advanced Patterns

Compare blur vs focusout, pass eventData, and pair with focusin for complete form UX.

Example 3 — blur vs focusout: Parent Handler Test

A handler on #wrapper only fires with focusout — not with direct blur binding on the wrapper.

jQuery
var log = [];

$( "#wrapper" ).on( "blur", function() {
  log.push( "blur on wrapper (will NOT run for nested input)" );
} );

$( "#wrapper" ).on( "focusout", function() {
  log.push( "focusout on wrapper (runs when input inside loses focus)" );
  $( "#out" ).text( log.join( " | " ) );
} );
Try It Yourself

How It Works

Native blur does not bubble — the wrapper’s blur handler only runs if the wrapper itself loses focus. focusout bubbles from the input upward, so the wrapper handler runs every time.

Example 4 — Pass eventData to a Delegated Handler

Pass a validation rule object to every input’s focusout handler via one form binding.

jQuery
$( "#profile-form" ).on( "focusout", { rule: "required" }, "input", function( event ) {
  var empty = $( this ).val().trim().length === 0;
  $( this ).toggleClass( "invalid", empty );
  $( "#out" ).text( "Left: " + $( this ).attr( "name" ) + " | rule: " + event.data.rule );
} );
Try It Yourself

How It Works

jQuery attaches { rule: "required" } to event.data for every delegated focusout callback. The same pattern works with .on("focusout", eventData, handler) without a selector.

Example 5 — Pair focusin and focusout on a Form

Highlight the active field on enter, validate on exit — two handlers, one parent form.

jQuery
var $form = $( "#contact-form" );

$form.on( "focusin", "input", function() {
  $form.find( "input" ).removeClass( "active" );
  $( this ).addClass( "active" );
} );

$form.on( "focusout", "input", function() {
  $( this ).removeClass( "active" );
  var empty = $( this ).val().trim().length === 0;
  $( this ).toggleClass( "required-missing", empty );
} );
Try It Yourself

How It Works

This is the pattern the official jQuery API recommends: focusin for enter styling, focusout for exit validation. Both bubble, so one binding site covers dynamic fields.

🚀 Common Use Cases

  • Parent form validation — one .on("focusout", "input", fn) on the form validates every field on exit.
  • Nested containers — official demo: bind on <p> to detect when any child input loses focus.
  • Dynamic AJAX forms — fields added after load still trigger the same delegated focusout handler.
  • Wizard steps — track which section the user finished editing via focusout on step containers.
  • Pair with focusin — enter/exit styling on the same parent without per-field bindings.
  • Force validation before submit$("#email").trigger("blur") inside a submit handler fires focusout too.

🧠 How the focusout Event Bubbles

1

Input has focus

User is editing a nested <input> inside a form.

input
2

Focus moves away

User tabs to next field, clicks elsewhere, or script calls .trigger("blur").

leave
3

blur fires (no bubble)

Browser sends blur directly to the input — handlers on ancestors do not receive it.

blur
4

focusout bubbles up

focusout fires on the input, then the form, then ancestors — your parent handler validates or updates UI. $(this) is the matched input when using a selector filter.

📝 Notes

  • Bind with .on("focusout", handler) since jQuery 1.7.
  • Trigger with .trigger("focusout") since jQuery 1.0 — runs handlers; use .trigger("blur") to move keyboard focus away.
  • Native focusout bubbles — ideal for parent-level and delegated handlers.
  • Native blur does not bubble — bind directly on the input for single-field handlers.
  • jQuery maps delegated .on("blur", selector, fn) to focusout since 1.4.2.
  • Pair with focusin on the same parent for complete enter/exit tracking.
  • Use .triggerHandler("focusout") to run handlers without bubbling propagation.
  • Use .off("focusout") to remove handlers — avoid deprecated .unbind("focusout").

Browser Support

The focusout event is a standard DOM focus event supported in every browser jQuery targets. jQuery’s .on("focusout") (since 1.7) and .trigger("focusout") (since 1.0) work across jQuery 1.x, 2.x, and 3.x.

jQuery 1.7+

jQuery focusout event

Supported in jQuery 1.x, 2.x, and 3.x across all modern browsers and IE with supported jQuery versions. Native equivalent: element.addEventListener('focusout', fn) — jQuery adds collection binding, eventData, delegation, and .trigger() in one chainable API.

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 Universal

Bottom line: Safe in any jQuery project. Use focusout for parent-form validation. Pair with focusin. Use .trigger('blur') to move keyboard focus away — not .trigger('focusout') alone.

Conclusion

The jQuery focusout event is the bubbling counterpart to blur. Bind one handler on a parent form with .on("focusout", "input", fn), pass optional eventData, and pair with focusin for complete enter/exit UX on dynamic forms.

Use focusout when you need delegation — the official paragraph demo shows how it differs from non-bubbling blur. For single-field handlers, blur on the input itself is simpler. Continue with the .blur() shorthand tutorial for legacy code, or the blur event tutorial for the non-bubbling API.

💡 Best Practices

✅ Do

  • Bind .on("focusout", "input", fn) on parent forms for dynamic fields
  • Pair focusin and focusout on the same container
  • Use explicit focusout when bubbling semantics should be clear in code
  • Pass eventData to share validation rules across all delegated inputs
  • Use .trigger("blur") to move keyboard focus — focusout handlers run automatically

❌ Don’t

  • Bind .on("blur", fn) on a parent expecting it to catch child input blur — it will not bubble
  • Confuse .trigger("focusout") with moving keyboard focus — use .trigger("blur")
  • Rebind handlers every time AJAX adds a field — delegation makes that unnecessary
  • Forget the focusin pair — users need enter styling too
  • Attach focusout on document in production without throttling — it fires on every focus change

Key Takeaways

Knowledge Unlocked

Six things to remember about the focusout event

Bubble, delegate, validate on exit.

6
Core concepts
form02

Delegate

One bind

Dynamic
03

vs blur

No bubble

Compare
in04

focusin

Enter pair

Pair
p05

<p> demo

Official

API
.off06

.off("focusout")

Unbind

Cleanup

❓ 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 tree — so you can bind one handler on a parent form and validate or style fields when the user leaves any nested input. Bind with .on('focusout', handler) since jQuery 1.7.
Both relate to an element 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, including fields added later.
Yes. Native focusout bubbles from the element that lost focus up through parent nodes. That is why .on('focusout', 'input', fn) on a form works — the event reaches the form after the input loses focus. jQuery also maps delegated .on('blur', 'input', fn) to focusout internally since 1.4.2.
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 complete enter/exit tracking and validation across dynamic forms.
Call .trigger('focusout') on an element since jQuery 1.0. Triggering focusout runs bound focusout handlers. To actually move keyboard focus away, tab to another field or call .trigger('blur') on the current input — that fires both blur and focusout in the browser. Use .triggerHandler('focusout') to run handlers without bubbling side effects.
Use explicit focusout when bubbling semantics should be clear in code, or when binding on a parent: $('#form').on('focusout', fn). Use .on('blur', 'input', fn) when you prefer the blur name — jQuery delegates via focusout under the hood. Both work for dynamic form validation on exit.
Did you know?

Because native blur does not bubble, jQuery’s event delegation maps .on("blur", selector, fn) to the bubbling focusout event under the hood since version 1.4.2. Binding .on("focusout", ...) directly makes the same behavior explicit — the approach used in the official jQuery API paragraph demo comparing focusout and blur counts.

Next: .focusout() Method

Legacy shorthand — read and migrate older focusout binding code.

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

6 people found this page helpful