jQuery Blur Event

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

Definition

The blur event fires when an element loses focus — Tab away, click elsewhere, or call .trigger("blur"). Bind with .on("blur", handler) (since jQuery 1.7). Originally for form fields; modern browsers also send it on other focusable elements.

Syntax

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

jQuery
$("#email").on("blur", function () {
  // user left this field
});

$("#email").trigger("blur");   // fire in code

// Opposite: focus = gains focus
// Bubbling sibling: focusout (use for delegation)
// Legacy shorthand: .blur() — prefer .on / .trigger
CallWhat it does
BlurLearn the jQuery blur event: bind with .on('blur'), trigger with .trigger('blur'), compare blur vs focus and focusout, validate on field exit, and avoid the deprecated .blur() shorthand.

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

Parameters

ParameterDescription
Step 1Select the element ($("#email"), $("input.name"), …).
Step 2Call .on("blur", handler) — optional eventData before the handler.
Step 3In the handler, read this / $(this) 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 — Bind a Blur Handler

Log a message when the field loses focus (official idea).

jQuery
$("#target").on("blur", function () {
  $("#out").text("Handler for blur called.");
});
Try It Yourself

How It Works

  1. Select. $("#target") is the input to watch.
  2. Bind. .on("blur", …) registers the handler (1.7+).
  3. Leave. Tab away or click elsewhere — blur fires.

Example 2 — Trigger Blur from a Button

Official pattern: another element can fire the same handler.

jQuery
$("#target").on("blur", function () {
  $("#out").text("blur handler ran");
});

$("#other").on("click", function () {
  $("#target").trigger("blur");
});
Try It Yourself

How It Works

  1. Same handler. Bound once on #target.
  2. Natural blur. Leaving the field still runs it.
  3. Button. Click calls .trigger("blur").

Example 3 — Simple Validation on Blur

Check a required field when the user finishes editing it.

jQuery
$("#email").on("blur", function () {
  var value = $(this).val().trim();
  if (value === "") {
    $("#out").text("Email is required.");
  } else {
    $("#out").text("Looks good: " + value);
  }
});
Try It Yourself

How It Works

  1. Wait. Validation runs after the user leaves the field.
  2. Read. $(this).val() is the current text.
  3. Check. Empty (after trim) → show an error message.

Frequently Asked Questions

The blur event fires when an element loses focus — the user tabs away, clicks elsewhere, or you call .trigger("blur"). Bind handlers with .on("blur", handler) (since 1.7). It applies to form controls and other focusable elements.
They are opposites. focus fires when an element gains focus; blur fires when it loses focus. Pair them for UX: show a hint on focus, validate or hide it on blur.
No. Native blur does not bubble. For one handler on a parent form (including dynamic fields), use focusout — it bubbles. Since 1.4.2, jQuery maps blur to focusout in its delegation methods.
Call $('#target').trigger("blur"). That runs bound blur handlers and moves focus away per browser rules. Useful when a button should force a field’s blur validation before submit.
Both. Blur gives feedback right after the user leaves a field. Submit catches anything missed. Common pattern: light checks on blur, full form check on submit.
blur is the event name used with .on("blur") / .trigger("blur"). .blur() is the deprecated shorthand method — prefer .on("blur") and .trigger("blur") in new code (deprecated since jQuery 3.3).

Next: Focusout Event

Use a bubbling lose-focus event on parent forms.

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

10 people found this page helpful