Form autocomplete attribute
Definition and Usage
autocomplete
Sets or returns the value of the autocomplete attribute in the form.
After enabling autocomplete, the browser will automatically complete values based on the user's previous input.
Tip: You can set the form to "enable" autocomplete, and set the specific input field to "disable", and vice versa.
Tip: In some browsers, you may need to enable the autocomplete feature to make it work properly (check the "Preferences" menu in the browser menu).
See also:
HTML Reference Manual:HTML <form> autocomplete Attribute
Example
Example 1
Set autocomplete to off:
document.getElementById("myForm").autocomplete = "off";
Example 2
Return the state of autocomplete:
var x = document.getElementById("myForm").autocomplete;
Syntax
Return the autocomplete attribute:
formObject.autocomplete
Set the autocomplete attribute:
formObject.autocomplete = on|off
Attribute Value
Value | Description |
---|---|
on | Default. Browsers will auto-complete values based on the user's previous inputs. |
off | The user must enter a value in each field every time they use it. Browsers will not auto-complete entries. |
Technical Details
Return Value: | A string value that represents the state of auto-complete. |
---|
Browser Support
The numbers in the table indicate the first browser version that fully supports this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |