Originally, this event was only applicable to form elements, such as . In modern browsers, the domain of the event has been extended to include all element types. An element can lose focus via keyboard commands or by mouse clicks elsewhere on the page.

Syntax

Example

In the jQuery code listed above, the blur() method specifies that a function should run when the blur event occurs. In the example above, the input element’s background-color property will be changed when it loses focus.