Javatpoint Logo

91-9990449935

 0120-4256464

jQuery blur()

The jQuery blur event occurs when element loses focus. It can be generated by via keyboard commands like tab key or mouse click anywhere on the page.

It makes you enable to attach a function to the event that will be executed when the element loses focus. Originally, this event was used only with form elements like <input>. In latest browsers, it has been extended to include all element types.

The blur () method is often used together with focus () method.

Syntax:

It triggers the blur event for selected elements.

It adds a function to the blur event.

Parameters of jQuery blur() event

Parameter Description
Function It is an optional parameter. It is used to specify the function to run when the element loses the focus (blur).

Example of jQuery blur() event

Let's take an example to demonstrate jQuery blur() event.

Test it Now

Output:

Enter your name:

Note: Write your name in the input field, and then click outside the field to lose focus (blur).

Next TopicjQuery focus()