Easy Tutorial
❮ Att Option Selected Att Select Autofocus ❯

HTML <button> autofocus Attribute

HTML <button> Tag

Example

Button using the autofocus attribute:


Browser Support

Internet Explorer 10, Firefox, Chrome, and Safari support the autofocus attribute.

Note: Internet Explorer 9 and earlier versions do not support the autofocus attribute.


Definition and Usage

The autofocus attribute is a boolean attribute.

The autofocus attribute specifies that the button should automatically get focus when the page loads.


Differences Between HTML 4.01 and HTML5

The autofocus attribute is new in HTML5 for the <button> tag.


Differences Between HTML and XHTML

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


Syntax


❮ Att Option Selected Att Select Autofocus ❯