.focusin() Keyboard Event

Syntax

$(selector).focusin(function())

Description

".focusin()" keyboard event is used to focus the element when it gets triggered. .focusin() event works with any selector elements. function() specifies the action to be done when the event occurs. The example stated below shows you how to change the style of the form and display field validation when the event is triggered.

Example Code

Result:


Test by clicking in to the input fields to get focus.
Username: Only Alphabets
Password: Minimum of 6 Characters
Male Female



Ask Questions

Ask Question