English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery blur() method

jQuery Events

The blur() method triggers the blur event or attaches a function to be executed when the blur event occurs.

A focus is lost event occurs when an element loses focus.

This method is usually used withfocus()Methods used together.

Syntax:

Trigger the focus is lost event of the selected element:

$(selector).blur()

Attach a function to the focus is lost event:

$(selector).blur(function)

Example

Trigger the focus is lost event of <input>:

$(document).ready(function(){
  $("input").blur();
});
Test and see‹/›

Attach a function to the focus is lost event (a focus is lost event occurs when an <input> field loses focus):

$("input").blur(function(){
  alert("Handler for .blur() called.");
});
Test and see‹/›

Attach a function to the focus is lost event (a focus is lost event occurs when an <input> field loses focus):

$("input").blur(function(){
  $(this).css("background", "white");
});
Test and see‹/›

Parameter Values

ParametersDescription
functionFunctionality executed when the focus is lost event is triggered

jQuery Events