Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

HTML | <button> autofocus Attribute

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The HTML | <button> autofocus Attribute is used to specifies that the button should get automatically get focus or not when the page loads. It is a Boolean Attribute.

Syntax:

<button type="button" autofocus> 

Example: This Example illustrates the use of autofocus attribute in Button Element.




<!DOCTYPE html>
<html>
  
<head>
    <title>
        HTML | 
      <button>autofocus Attribute
    </title>
</head>
  
<body style="text-align:center">
  
    <h1 style="color: green;"
        GeeksforGeeks 
    </h1>
  
    <h2
        HTML |  
      <button>autofocus Property 
    </h2>
  
    <!-- Assign id to the Button. -->
    <button id="GFG"
            autofocus>
        Submit
    </button>
  
    <br>
</body>
  
</html>


Output:

Supported Browsers: The browser supported by HTML | <button>autofocus Attribute are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari
My Personal Notes arrow_drop_up
Last Updated : 29 Apr, 2019
Like Article
Save Article
Similar Reads
Related Tutorials