Name
Input.focus( ): give keyboard focus to a form element â DOM Level 2 HTML
Synopsis
void focus( )
Description
The focus( )
method of a
form element transfers keyboard focus to that element and triggers
any onfocus event handlers that were registered on the element. That
is, it makes the element active with respect to keyboard navigation
and keyboard input. Thus, if you call focus( )
for an input element of type
âtextâ, any text the user subsequently types appears in that text
element. Or, if you call focus( )
for an element of type âbuttonâ, the user can then invoke that
button from the keyboard.
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.