How can a input field should automatically get focus when the page loads?
The new HTML5 “autofocus” is used to provide focus to an input field when page loads see below code.
<!DOCTYPE html> <html> <body> <h2>Telephone Field</h2> <p>The <strong>input type="tel"</strong> is used for input fields that should contain a telephone number:</p> <form action="/action_page.php"> Telephone: <input type="tel" name="phone" pattern="[0-9]{3}-[0-9]{2}-[0-9]{3}" required> <input type="submit"> <span>Format: 123-45-678</span> </form> </body> </html>
Reference site :- https://www.w3schools.com/html/html_form_attributes.asp
Share