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