JavaScript Element blur Event

Beginner
5 min read
Updated: Nov 2026
3 examples
Event

Definition

In JavaScript, the blur event fires when an element has lost focus (MDN). The opposite is focus. blur does not bubble; the related focusout event that follows does.

Register a listener with addEventListener. Check readiness and browser support before you rely on this event.

Syntax

Listen for blur. Start with this line.

JavaScript
el.addEventListener("blur", fn)
CallWhat it does
el.addEventListener("blur", fn)Primary signature.

Built into the browser. Listen with el.addEventListener("blur", …) — no import required.

Library declarations
JavaScript
el.addEventListener("blur", fn)

Parameters

ParameterDescription
Focusable targetRequired. input, button, a, tabindex, …
Bubbling?Optional. Use focusout or capture for parents

Return Value

Return ValueDescription
*Fires as an Element event (listener receives the Event object).

JavaScript Examples

Example 1 — Listen When Focus Leaves

Log a message when the password field loses focus.

JavaScript
const password = document.querySelector('input[type="password"]');
const out = document.getElementById("out");

password.addEventListener("blur", () => {
  out.textContent = "Password field lost focus";
});
Try It Yourself

How It Works

  1. Select the control. Any focusable element can fire blur.
  2. Listen for blur. Runs when focus leaves that element (MDN).
  3. Update the UI/log. Common for validation or cleanup.
  4. Pair with focus if you also need “entered” behavior.

Example 3 — Capture Delegation (MDN)

Because blur does not bubble, listen on a parent with capture: true.

JavaScript
const form = document.getElementById("form");
const out = document.getElementById("out");

form.addEventListener(
  "blur",
  (event) => {
    out.textContent = "blur (capture): " + event.target.tagName;
  },
  true
);
Try It Yourself

How It Works

  1. Listen on the form. One handler for many fields.
  2. Pass true (capture). Runs in the capture phase (MDN).
  3. Read event.target. The field that actually lost focus.
  4. Or use focusout if you prefer bubbling without capture.

Browser Support

Element.blur is marked Baseline Widely available on MDN (since July 2015). Logos use the shared browser-image-sprite.png sprite from this project.

✓ Baseline · Widely available

Element blur

Fires when an element loses focus — FocusEvent, non-bubbling, not cancelable.

Widely Available
Google Chrome Full support · Desktop & Mobile
Full support
Mozilla Firefox Full support · Desktop & Mobile
Full support
Apple Safari Full support · macOS & iOS
Full support
Microsoft Edge Full support · Chromium
Full support
Opera Full support · Modern versions
Full support
Internet Explorer Supported (legacy)
Supported
blur Baseline support

Bottom line: Safe everywhere modern. Remember: no bubble, no cancel — use focusout or capture for delegation. See the MDN Element blur reference.

Frequently Asked Questions

The blur event fires when an element has lost focus (MDN). The opposite event is focus, which fires when an element receives focus.
No. MDN marks Element blur as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
No. blur does not bubble. The related focusout event that follows does bubble. For event delegation you can use focusout, or listen to blur with useCapture set to true (MDN).
No. The blur event is not cancelable. You cannot prevent focus from leaving with preventDefault() on blur.
A FocusEvent (inherits from UIEvent). A useful property is relatedTarget — the element receiving focus, if any.
Besides clicking or tabbing elsewhere, focus can leave if a style that prevents focus is applied (for example hidden), or if the element is removed from the document. Browser behavior differs when a focused element is removed: Chromium often fires blur; Firefox may not (MDN).

Next: Element click

Learn the primary-button activation event on elements.

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

11 people found this page helpful