Dofactory.com
Dofactory.com

HTML <select> autocomplete Attribute

The autocomplete attribute on a <select> tag specifies that the select element is autocompleted with a previously selected option.

This attribute suggests values based on previously entered values by the user.

Example

#

An autocomplete attribute on a <select> tag.


<form action="/tutorial/action.html">
  <select name="color" autocomplete="on"> 
    <option value="">-- Select Color --</option> 
    <option value="red">Red</option> 
    <option value="blue">Blue</option> 
    <option value="green">Green</option> 
  </select> <br />

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

Using autocomplete

The autocomplete attribute specifies that the control uses autocomplete.

With autocomplete on, the browser sets select values based on what the user entered before.

Most browsers intentionally ignore autocomplete="off".


Syntax

<select autocomplete="on | off">

Values

#

Value Description
on Enables autocomplete in select field.
off Disables autocomplete in select 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 <select>

Last updated on Sep 30, 2023




Guides