jQuery Tutorial Tutorials - jQuery .focusout() method

jQuery .focusout() method

The .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.

jQuery .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.

jQuery .focusout() method Example

example

Watch 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.");
});

Try now

Date:2019-08-29 19:33:22 From:www.Lautturi.com author:Lautturi