HTML Attributes
HTML <form> autocomplete Attribute
The autocomplete attribute on a <form> sets the default autofill behaviour for all fields inside it.
The <form> autocomplete Attribute
When placed on the <form> element, autocomplete defines the default for every input, textarea and select in the form. Individual fields can still override this by setting their own autocomplete attribute, giving you form-wide control with per-field exceptions.
Syntax
ℹ️
Syntax: <form autocomplete="on"> or <form autocomplete="off">. The default is on when the attribute is not specified.
<form autocomplete="off">
<input type="text" name="code" placeholder="One-time code">
<input type="email" name="email" autocomplete="email">
</form>| Value | Description |
|---|---|
| on | Fields may be autofilled by the browser (the default) |
| off | The browser should not autofill fields in this form by default |
⚠️
Setting autocomplete="off" is only a hint. Browsers may ignore it for login and password fields to keep password managers working, so never rely on it for security.
