âš ī¸ Warning âš ī¸ Deprecated Code! This video tutorial contains outdated code.
💡 If you wish to update it, any AI assistant will update the code for you in seconds.

Autofocus Form Input Attribute Tutorial

Published : November 16, 2014   •   Last Edited : November 24, 2025   •   Author : Adam Khoury
Learn to apply autofocus to your HTML web form input fields to force a blinking cursor to appear in your target text field, which will draw the users eye and instruct them to begin typing.
<!DOCTYPE html>
<html>
<body>
<h2>HTML5 Form Input Autofocus Attribute Example</h2>
First Name: 
<input type="text" id="fname" name="fname" autofocus >
<br><br>
Last Name: 
<input type="text" id="lname" name="lname">
</body>
</html>