Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery blur() method

jQuery blur() method

jQuery event methods jQuery event methods

Example

Add a function to the blur event. When the field loses focus, a blur event occurs:

$("input").blur(function(){

    alert("The input field lost focus");

});

Try it »


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:** This method is often used with focus() the method.


Syntax

Trigger the blur event for the selected element:

$(

selector

).blur()

Try it

Add a function to the blur event:

$(

selector

).blur(

function

)

Try it

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

jQuery event methods jQuery event methods