Example

Change background color of an 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 an element loses focus.

The blur() method triggers the blur event, or specifies a function to run when a blur event occurs.

Tip: In newer browsers, the blur event can be used on all elements (not only form elements).


Trigger the blur Event

Trigger the blur event for the selected elements.

Syntax

$(selector).blur()
Try it yourself »


Bind a Function to the blur Event

Specifies a function to run when the blur event occurs for the selected elements.

Syntax

$(selector).blur(function)
Try it yourself »

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