A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-button-autofocus-attribute/ below:

HTML <button> autofocus Attribute - GeeksforGeeks

HTML <button> autofocus Attribute

Last Updated : 04 Jul, 2023

The HTML <button> autofocus Attribute is used to specify whether the button should get automatically get focused 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.

html
<!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:

HTML button autofocus Property

Supported Browsers:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4