How to place the cursor (auto focus) in text box when a page gets loaded without JavaScript support with HTML?

Spread the love

To place the cursor (auto focus) in text box when a page gets loaded without JavaScript support with HTML, we add the autofocus attribute.

For instance, we write

<input type="text" name="name" id="name" autofocus="autofocus" />

to add the autofocus attribute to the input to make it focused when the page loads

Leave a Reply

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