Lesson 7 of 9
Autocomplete & Mobile Optimization
The autocomplete attribute helps browsers auto-fill form fields with saved user data (name, email, address, credit card). This significantly improves conversion rates - Google reports that autocomplete reduces form completion time by 30%. The inputmode attribute controls which keyboard appears on mobile devices, and enterkeyhint changes the Enter key label.
Autocomplete & Mobile Attributes
The autocomplete attribute tells the browser what type of data a field expects:
autocomplete='name' - Full name
autocomplete='email' - Email address
autocomplete='tel' - Phone number
autocomplete='street-address' - Street address
autocomplete='postal-code' - ZIP/postal code
autocomplete='cc-number' - Credit card number
autocomplete='new-password' - Suggests strong password
autocomplete='one-time-code' - OTP/verification code
autocomplete='off' - Disable autofill for sensitive fields
Mobile keyboard control:
• inputmode='numeric' - Number pad (for card numbers, OTP)
• inputmode='decimal' - Number pad with decimal (for prices)
• inputmode='tel' - Phone keypad
• inputmode='email' - Keyboard with @ symbol
• inputmode='url' - Keyboard with .com key
• inputmode='search' - Keyboard with search button
Enter key label:
• enterkeyhint='next' - Shows 'Next' on Enter key
• enterkeyhint='done' - Shows 'Done'
• enterkeyhint='search' - Shows '🔍 Search'
• enterkeyhint='send' - Shows 'Send'
• enterkeyhint='go' - Shows 'Go'
Autocomplete tokens enable one-tap form autofill on modern browsers
Quick Quiz: Autocomplete
Finished this lesson?