autocomplete
Tells the browser which saved data to fill into a field.
Syntax
<input name="email" autocomplete="email">Parameters
| Parameter | Type | Description |
|---|---|---|
| autocomplete | on | off | name | email | tel | street-address | new-password | one-time-code | … | What data the field holds — the browser uses it to fill in saved values. |
Examples
A delivery form with autofill:
<form>
<p><input name="name" autocomplete="name" placeholder="Full name"></p>
<p><input name="email" type="email" autocomplete="email" placeholder="Email"></p>
<p><input name="address" autocomplete="street-address" placeholder="Address"></p>
<p><input name="code" autocomplete="one-time-code" inputmode="numeric" placeholder="SMS code"></p>
</form>Notes
Precise values save users time, especially on phones. For a new password field write new-password — the browser will offer to generate a strong one. Browsers often ignore off for logins and passwords.
See also
Related recipes
In the tutorial
- Forms — How a form works in HTML — the form tag, the input field, the name attribute, the submit button, action and the GET and POST methods.