.focusout() methodThe .focusout() method in jQuery is used to bind an event handler to the focusout event.
It supports event bubbling. When an element ,or any element inside of it,loses focus, a focusout event would be sent to it.
The blur event does not bubble.
.focusout() method Syntax.focusout() .focusout(handler) .focusout(eventData,handler)
| Parameter | Type | Description |
|---|---|---|
handler |
Function | A function to execute when the focusout is triggered on the matched element. |
eventData |
Anything | Additional data passed to the event handler. |
.focusout() method ExampleWatch for a loss of focus to occur inside paragraphs.
The blur() handler does not be called because the blur event does not bubble.
HTML
<p><input type="text" name="username"></p> <p><input type="text" name="email"></p>
$( "p" ).focusout(function() {
console.log("Handler for .focusout() called.");
}).blur(function() {
console.log("Handler for .blur() called.");
});
