Username: "> Username: " />
Easy Tutorial
❮ Av Met Play Tag Small ❯

HTML <keygen> autofocus Attribute

HTML <keygen> Tag

Example

Automatically focus the "Encryption" field when the page loads:

<form action="demo_keygen.html" method="get">
  Username: <input type="text" name="usr_name">
  Encryption: &lt;keygen name="security" autofocus>
  <input type="submit">
</form>

Browser Support

Opera, Chrome, and Safari 6 support the autofocus attribute for the <keygen> tag.


Definition and Usage

The autofocus attribute is a boolean attribute.

The autofocus attribute specifies that the <keygen> element should automatically get focus when the page loads.


Differences Between HTML 4.01 and HTML5

The <keygen> tag is new in HTML5.


Differences Between HTML and XHTML

In XHTML, attribute minimization is forbidden, and the autofocus attribute must be defined as <keygen autofocus="autofocus" />.


Syntax

❮ Av Met Play Tag Small ❯