HTML <button> Tag with the 'autofocus' Attribute
<button autofocus> Autofocus </button>
Here, we add the
autofocus attribute to a button control.
autofocus attribute automatically gives focus to the control when the page loads. This allows the user to start using the control without having to select it first. There must not be more than one element in the document with the autofocus attribute specified.
autofocus attribute is a boolean attribute. Therefore, if the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace (i.e. either
- [Empty string]
<button> element creates a button control in an HTML document.
Any contents of the
<button> element appears on the button.
onclick attribute) to make the button actually do something.