How to focus the input box on page load with HTML?

Spread the love

To focus the input box on page load with HTML, we add the autofocus attribute.

For instance, we write

<input type="text" autofocus />

to add an input with the autofocus attribute to focus on the input when the page loads.

Leave a Reply

Your email address will not be published. Required fields are marked *