The blur event fires when an element loses focus — the user tabs away, clicks elsewhere, or you call .trigger("blur"). This tutorial covers binding with .on("blur"), passing eventData, triggering programmatically, comparing blur with focus and focusout, and practical form-validation patterns.
01
.on()
Bind handler
02
eventData
Pass data
03
.trigger()
Fire blur
04
vs focus
Gain / lose
05
focusout
Delegation
06
Since 1.7
Modern API
Fundamentals
Introduction
Forms and interactive pages depend on knowing when a user finishes with a field. The blur event tells you an element no longer has focus — ideal for validating input, trimming whitespace, saving drafts, or hiding inline hints.
The official jQuery API distinguishes the blurevent (bound with .on("blur") since 1.7) from the deprecated .blur()method used in older code. To programmatically run blur handlers, use .trigger("blur") — available since jQuery 1.0.
Concept
Understanding the blur Event
The blur event is sent to an element when it loses focus. Originally this applied mainly to form controls — <input>, <textarea>, and <select>. Modern browsers extend it to any focusable element, including elements with tabindex.
An element loses focus when the user presses Tab to move to the next control, clicks another part of the page, or when JavaScript moves focus elsewhere. jQuery normalizes cross-browser quirks — including IE’s asynchronous native blur — so your handlers behave consistently.
💡
Beginner Tip
Think of blur as “the user is done with this field for now.” That is the perfect moment to validate email format, check a required field, or auto-save without waiting for the whole form submit.
Foundation
📝 Syntax
The modern jQuery API for the blur event has two main forms — binding a handler and triggering the event:
.on() and .trigger() return the original jQuery object for chaining.
Handler return values are ignored unless you use return false (equivalent to preventDefault() + stopPropagation()).
Cheat Sheet
⚡ Quick Reference
Goal
Code
Bind blur handler
$("#email").on("blur", fn)
Pass data to handler
$("#email").on("blur", { rule: "email" }, fn)
Delegated blur on inputs
$("#form").on("blur", "input", fn)
Trigger blur programmatically
$("#target").trigger("blur")
Trigger all matched elements
$("input").trigger("blur")
Remove blur handlers
$("#email").off("blur")
Bubbling alternative
$("#form").on("focusout", "input", fn)
Compare
📋 blur vs focus vs focusout vs deprecated .blur()
Four related APIs — pick the event that matches when focus changes and whether you need bubbling.
blur
loses focus
Fires on the element that lost focus — does not bubble; best for single-field handlers
focus
gains focus
Opposite of blur — fires when the user enters a field; pair for show/hide hints
focusout
bubbles
Like blur but bubbles — one handler on a parent form covers all nested inputs
.blur() method
deprecated
Old binding shorthand — use .on("blur") and .trigger("blur") instead
Hands-On
Examples Gallery
Examples 1–2 follow the official jQuery API documentation. Examples 3–5 show real-world form patterns. Use the Try-it links to run each snippet in the browser.
📚 Binding & Triggering
Official jQuery demos for blur handlers and programmatic triggers.
Example 1 — Official Demo: Bind Handler on #target
Alert when the first input field loses focus — the canonical .on("blur") pattern.
User focuses #target, then tabs away or clicks elsewhere
→ alert: "Handler for blur called."
Handler runs once each time the field loses focus
How It Works
.on("blur", fn) registers the function on the input. jQuery calls it when the browser fires blur — after the user moves focus to another element via Tab, click, or keyboard navigation.
Example 2 — Official Demo: #other Triggers Blur on #target
One button programmatically fires the blur handler on an input field.
Tab away from #target → alert runs
Click #other → $("#target").trigger("blur") → same alert
Programmatic trigger invokes bound handlers
How It Works
.trigger("blur") synthetically fires the blur event on #target, running the same handler as when the user leaves the field naturally. Useful for forcing validation before form submit.
📈 Practical Form Patterns
Validation, cleanup, and delegation for real signup and contact forms.
Example 3 — Validate Email Format on Blur
Show an error message when the user leaves the email field with invalid input.
jQuery
$( "#email" ).on( "blur", function() {
var value = $( this ).val().trim();
var isValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test( value );
$( "#email-error" ).toggle( !isValid && value.length > 0 );
$( this ).toggleClass( "invalid", !isValid && value.length > 0 );
} );
User types "not-an-email" and tabs away
→ #email-error appears, .invalid class added
User types "user@example.com" and tabs away
→ error hidden, .invalid removed
How It Works
Blur is the natural checkpoint — the user finished editing this field. Checking on blur gives immediate feedback without interrupting typing on every keystroke (which input or keyup would do).
Example 4 — Trim Whitespace When Field Loses Focus
Clean accidental leading or trailing spaces from a name field on blur.
jQuery
$( "#name" ).on( "blur", function() {
var trimmed = $( this ).val().trim();
$( this ).val( trimmed );
console.log( "Saved name:", trimmed );
} );
User types " Jane Doe " and tabs away
→ input value becomes "Jane Doe"
→ console: Saved name: Jane Doe
How It Works
Updating the value on blur keeps the field editable while typing but normalizes data before submit. The user sees cleaned text when they return to the field.
Example 5 — One Handler for All Inputs via focusout
Because blur does not bubble, use focusout on the form to handle every input — including fields added later.
jQuery
$( "#signup-form" ).on( "focusout", "input", function() {
var $field = $( this );
var empty = $field.val().trim().length === 0;
$field.toggleClass( "required-missing", empty );
} );
Tab out of empty input → .required-missing added
Tab out of filled input → .required-missing removed
New input appended to form → same handler applies
How It Works
focusout bubbles from the input to #signup-form. jQuery’s delegated .on("blur", "input", fn) uses the same mechanism internally. One binding covers all current and future inputs.
Applications
🚀 Common Use Cases
Field validation — check email, phone, or password format when the user leaves the input.
Trim & normalize — strip whitespace, fix casing, or format phone numbers on blur.
Auto-save drafts — persist textarea content when focus leaves the editor.
Hide helper text — pair with focus to show hints on entry and hide on exit.
Force validation before submit — $("#email").trigger("blur") inside a submit handler.
Dynamic forms — delegated focusout on the form for inputs added via AJAX.
🧠 How the blur Event Flows
1
Element has focus
User clicked into the field or tabbed to it — the focus event already fired.
focus
2
Focus moves away
User tabs to next field, clicks elsewhere, or script calls .trigger("blur").
leave
3
blur event fires
Browser sends blur to the element that lost focus — jQuery runs bound handlers.
blur
4
✎
Handler runs
Your function executes — validate, trim, save, or update UI. $(this) is the field that lost focus.
Important
📝 Notes
Bind with .on("blur", handler) since jQuery 1.7 — not the deprecated .blur(handler) method.
Trigger with .trigger("blur") since jQuery 1.0.
Native blur does not bubble — use focusout or jQuery delegation for parent-level handlers.
jQuery maps blur to focusout in delegation methods since 1.4.2.
In Internet Explorer, native blur is asynchronous — jQuery 3.7+ uses focusout as the backing event in IE for consistency.
Any focusable element can receive blur — not limited to <input> and <textarea>.
Use .off("blur") to remove handlers — avoid deprecated .unbind("blur").
Compatibility
Browser Support
The blur event is a standard DOM focus event supported in every browser jQuery targets. jQuery’s .on("blur") (since 1.7) and .trigger("blur") (since 1.0) normalize cross-browser behavior — including IE’s asynchronous blur quirk handled in jQuery 3.7+.
✓ jQuery 1.7+
jQuery blur 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('blur', fn) — jQuery adds collection binding, eventData, delegation via focusout, and .trigger() in one chainable API.
100%With jQuery loaded
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
blurUniversal
Bottom line: Safe in any jQuery project. Prefer .on('blur') over deprecated .blur() for binding. Use focusout for delegation on parent forms.
Wrap Up
Conclusion
The jQuery blur event is the standard way to respond when a user finishes with a field. Bind handlers with .on("blur", fn), pass optional eventData, and fire handlers programmatically with .trigger("blur").
Remember that blur does not bubble — for one handler on an entire form, use focusout or jQuery’s delegated blur syntax. Pair blur with focus for complete enter/exit UX, and validate on blur for friendly form feedback without interrupting every keystroke.
Bind with .on("blur", handler) — the modern, delegation-capable API
Validate on blur for field-level feedback after the user finishes editing
Use focusout or delegated blur for dynamic forms with many inputs
Call .trigger("blur") before submit to force last-field validation
Pair focus and blur for show/hide helper text patterns
❌ Don’t
Use deprecated .blur(handler) for new code — use .on("blur")
Expect blur to bubble — use focusout for parent-level handlers
Validate on every keystroke when blur-level feedback is enough
Move focus inside a blur handler without guarding against infinite loops
Forget accessibility — ensure error messages are linked with aria-describedby
Summary
Key Takeaways
Knowledge Unlocked
Six things to remember about the blur event
Bind, trigger, validate.
6
Core concepts
.on01
.on("blur")
Bind
API
⚡02
.trigger()
Fire
Programmatic
↔03
vs focus
Opposite
Pair
form04
focusout
Delegate
Bubbles
✎05
Validate
On exit
Forms
.off06
.off("blur")
Unbind
Cleanup
❓ Frequently Asked Questions
The blur event fires when an element loses focus. The user might tab to the next field, click elsewhere on the page, or call .trigger('blur') in code. In modern jQuery, bind handlers with .on('blur', handler) since version 1.7. Originally common on form inputs, blur now applies to any focusable element.
They are opposites. focus fires when an element receives focus — for example, the user clicks into an input or tabs to it. blur fires when that element loses focus. Pair them for show/hide hints: .on('focus') to reveal helper text, .on('blur') to validate or hide it.
No. Native blur does not bubble up the DOM tree. For event delegation on a parent form, use focusout instead — it bubbles and jQuery maps blur to focusout in delegation methods since 1.4.2. Direct binding with .on('blur', fn) on the input itself is the most common pattern.
Call $('#target').trigger('blur') on the element. Available since jQuery 1.0, trigger runs bound blur handlers and moves focus away according to browser rules. Useful for forcing validation when a submit button is clicked before the user tabs out of a field.
Both have roles. Blur validation gives immediate feedback after the user finishes a field — great for email format or required checks. Submit validation catches anything missed. A common pattern: light validation on blur, full form check on submit.
blur fires on the element that lost focus and does not bubble. focusout fires on the element that lost focus and bubbles — so a handler on a parent form can listen for focusout on any nested input. Use blur for single-field handlers; use focusout (or delegated blur via jQuery) for one handler on a dynamic form.
Did you know?
Because native blur does not bubble, jQuery’s event delegation maps blur to the bubbling focusout event under the hood since version 1.4.2. In jQuery 3.7+, IE’s asynchronous native blur is also normalized by using focusout as the backing event — so your handlers behave the same everywhere.