jQuery Event - blur() Method

Example

Change the color of the input field when it loses focus (blur):

$("input").blur(function() {
  $("input").css("background-color","#D6D6FF");
});

Try It Yourself

Definition and Usage

The blur event occurs when the element loses focus.

The blur() function triggers the blur event, or if set function Parameter, the code to be executed when the blur event occurs can also be specified by this function.

Tip:Previously, the blur event only occurred on form elements. In new browsers, this event can be used on any element.

Trigger blur event

Triggers the blur event of the selected element.

Syntax

$().blur()

Try It Yourself

Bind the function to the blur event

Specifies the function to be executed when the blur event occurs on the selected element.

Syntax

$().blur(function)

Try It Yourself

Parameter Description
function Optional. Specifies the function to be executed when the blur event occurs.