Dofactory.com
Dofactory.com

HTML <input> autocomplete Attribute

The autocomplete attribute on an <input> tag presents previously entered values as dropdown options to an input element.

This attribute only works with <input> controls of type: text, search, URL, email, password, date pickers, range, and color.

Example

#

An autocomplete attribute on 3 <input> elements.







<form action="/tutorial/action.html">
  <input type="text" autocomplete="on" name="firstname" placeholder="First name"><br /><br />
  <input type="text" autocomplete="on" name="lastname" placeholder="Last name"><br /><br />
  <input type="text" autocomplete="on" name="email" placeholder="Email"><br /><br />

  <button type="submit">Submit</button>
</form>

Using autocomplete

With autocomplete on, the browser completes input values based on what the user entered before.

Most browsers intentionally ignore autocomplete="off".


Syntax

<input autocomplete="on | off">

Values

#

Value Description
on Enables autocomplete on input field.
off Disables autocomplete on input field.

Browser support

Here is when autocomplete support started for each browser:

Chrome
17.0 Feb 2012
Firefox
2.0 Oct 2006
IE/Edge
6.0 Aug 2001
Opera
10.0 Oct 2009
Safari
5.1 Oct 2011

You may also like

 Back to <input>

Last updated on Sep 30, 2023




Guides