Name

Input.onfocus: event handler invoked when a form element gains focus — DOM Level 2 Events

Synopsis

Function onfocus

Description

The onfocus property of an Input object specifies an event-handler function that is invoked when the user transfers keyboard focus to that input element. Calling focus( ) to set focus to an element also invokes onfocus for that object.

See Also

Element.addEventListener( ), Window.onfocus; Chapter 17

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.