Input Text autocomplete Attribute

Definition and Usage

autocomplete Set the attribute or return the value of the autocomplete attribute in the text field.

After enabling autocomplete, the browser will automatically complete values based on the user's previous inputs.

Tip:In some browsers, you may need to enable the autocomplete feature to make it work properly (check under "Preferences" in the browser menu).

See also:

HTML Reference Manual:HTML <input> autocomplete Attribute

Example

Example 1

Set the autocomplete of the text field to off:

document.getElementById("myText").autocomplete = "off";

Try it yourself

Example 2

Return the state of autocomplete:

var x = document.getElementById("myText").autocomplete;

Try it yourself

Syntax

Return the autocomplete attribute:

textObject.autocomplete

Set the autocomplete attribute:

textObject.autocomplete = "on|off"

Attribute Value

Value Description
on Default. Browsers will automatically complete values based on the user's previous input.
off The user must enter a value in each text field every time they use it. Browsers will not automatically complete entries.

Technical Details

Return Value: A string value that represents the state of autocomplete.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support