jQuery :focus Selector (original) (raw)
Last Updated : 11 Jul, 2025
The jQuery :focus Selector is used to select all the elements that have focus on the document currently. It is also used with a tag name or using another selector.
Syntax:
$(":focus")
Example 1:
HTML `
GeeksForGeeks
jQuery :focus Selector
Name:Password:
Submit
`
Output:
Example 2:
HTML `
GeeksforGeeks
jQuery :focus Selector
Change
`
Output:
Supported Browsers: The browsers supported by jQuery :focus Selector are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
