JavaScript: The Definitive Guide

25.176. Input.focus( ): give keyboard focus to a form element

DOM Level 2 HTML

25.176.1. Synopsis

void focus( )

25.176.2. Description

The focus( ) method of a form element transfers keyboard focus to that element without calling the onfocus event handler. 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.

Категории