HTML: input autocomplete

The autocomplete attribute tells the browser what kind of previously entered information can help fill a form field.

What you will learn

Common tokens

<label for="email">Email</label>
<input id="email" name="email" type="email" autocomplete="email">

<label for="given-name">First name</label>
<input id="given-name" name="given-name" autocomplete="given-name">

Use a token that describes the data, such as email, name, street-address, or one-time-code. Correct tokens let browsers and password managers offer useful help.

Suggestions with datalist

<label for="browser">Browser</label>
<input id="browser" name="browser" list="browsers">
<datalist id="browsers">
  <option value="Firefox">
  <option value="Chrome">
</datalist>

The list value must match the datalist id. Suggestions do not necessarily restrict the user to only those values.

Common mistakes