The autofocus
attribute allows an input field to automatically focus when the page loads, without requiring the user to click inside the input field.
Let’s take a look:
In this example, the Full Name:
input field automatically gains focus when the page loads, allowing the user to start typing without needing to click inside the field.
The autofocus attribute can be added to any form input element, such as text inputs, text areas, or buttons. However, only one element in a form can have the autofocus attribute, otherwise the browser will focus on the first element with the attribute.