HTML <input> autocomplete Attribute
Definition and Usage
autocomplete
The attribute specifies whether the input field should be enabled for auto-complete.
Auto-complete allows the browser to predict values. When the user starts typing in the field, the browser should display options for filling the field based on previously entered values.
Note:autocomplete
The attribute applies to the following input types:
- text
- search
- url
- tel
- password
- datepickers
- range
- color
Example
An HTML form with auto-complete enabled, including an input field that disables auto-complete:
<form action="/action_page.php" autocomplete="on"> <label for="fname">Name:</label> <input type="text" id="fname" name="fname"><br><br> <label for="lname">Surname:</label> <input type="text" id="lname" name="lname"><br><br> <label for="email">Email:</label> <input type="email" id="email" name="email" autocomplete="off"><br><br> <input type="submit"> </form>
Syntax
<input autocomplete="on|off">
Attribute Value
Value | Description |
---|---|
on | Default. Specifies that auto-complete is turned on (enabled). |
off | Specifies that auto-complete is turned off (disabled). |
Browser Support
The numbers in the table indicate the first browser version that fully supports this property.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
17.0 | 6.0 | 2.0 | 5.1 | 10.0 |
Tip:In some browsers, you may need to manually enable the auto-complete feature (please see the 'Preferences' menu in the browser menu).
Note:autocomplete
Attributes are new properties in HTML5.