Learn all about the jQuery function .blur().
This method is a shortcut for
.on( "blur", handler ) in the first two variations, and
.trigger( "blur" ) in the third.
blur event is sent to an element when it loses focus. Originally, this event was only applicable to form elements, such as
<input>. In recent browsers, the domain of the event has been extended to include all element types. An element can lose focus via keyboard commands, such as the Tab key, or by mouse clicks elsewhere on the page.
For example, consider the HTML:
Now if the first field has the focus, clicking elsewhere or tabbing away from it displays the alert:
Handler for .blur() called.
To trigger the event programmatically, apply
.blur() without an argument:
After this code executes, clicks on Trigger the handler will also alert the message.
blur event does not bubble in Internet Explorer. Therefore, scripts that rely on event delegation with the
blur event will not work consistently across browsers. As of version 1.4.2, however, jQuery works around this limitation by mapping
blur to the
focusout event in its event delegation methods,