HTML autofocus attribute
Example
Make the "Encryption" field automatically focused when the page loads:
<form action="demo_keygen.html" method="get">Username:
<input type="text" name="usr_name">Encryption:
<
keygen
name
=
"
security
"
autofocus
<
input
type
=
"
submit
"
formTry it »
Browser support





Supported by Opera, Chrome, and Safari 6
Definition and Usage
The autofocus attribute is a boolean attribute.
The autofocus attribute specifies that when the page loads, the
Differences between HTML 4.01 and HTML5
Differences between HTML and XHTML
In XHTML, attribute minimization is forbidden, and the autofocus attribute must be defined as
Syntax
HTML