- Attribute of
- How To Use Input To Create Form Fields In HTML: Easy Tutorial
- What does
When To Use Input Autocomplete In HTML (And When List Or Datalist)do?
- Specifies whether the browser should attempt to automatically complete the input based on user inputs to similar fields.
<label for="email">Email Address</label><br>
<input type="email" name="email" id="email" autocomplete="on">
New(ish) in HTML5
autocomplete attribute was introduced as an unofficial HTML feature in Microsoft’s Internet Explorer, and was adopted by a number of other browsers. So there has been wide support for it for a long time, although its exact behavior wasn’t standardized. With HTML5, the
autocomplete attribute is an official part of the specification.
autocomplete attribute asks the browser to attempt autocompletion, based on user history. This is useful for personal details like name and email address — things the user is likely to have types into similar input fields on other web sites. The
autocomplete feature is not able to provide the browser with a list of site-specific autocomplete options. For autocomplete behavior with site-specific suggestions, use the
list attribute with the
All the major browsers ignore the
autocomplete="off" value for certain types of input fields. Internet Explorer and Edge ignore it for all
password fields. Firefox ignores it for any field in a login form. Chrome ignores it any time the user has elected to let the browser remember form data. Safari ignores it for username, email, and password fields. Ignoring the
autocomplete="off" value is done to enhance usability, and gve the user more control over autocomplete behavior. As a UX designer, you should follow their lead and use
autocomplete="off" sparingly. There are are very few use cases in normal forms where it really makes sense to disallow
autocomplete. In some complex apps, it makes sense to avoid accidental inputs, but with most standard forms there really is no reason for it.
Browsers use the
name attribute in order to figure out what type of information an input field is asking for. So use standard, meaningful values for
name. If you are asking for an address, use names like:
Don’t use clever or oddly specific names, as that makes it harder for the browser to provide autocomplete suggestions, and it can even lead to the browser trying to fill in the wrong values into the wrong inputs. (Have you ever had your browser fill your phone number into the zip code field? That was the fault of bad naming.)
Values of the
|Turns autocomplete off.
|Turns autocomplete on.
All Attributes of
|Specifies the interval between valid values in a number-based input.
|Specifies that the input field is required; disallows form submission and alerts the user if the required field is empty.
|Specifies placeholder text in a text-based input.
|Specifies a regular expression against which to validate the value of the input.
|Allows the user to enter multiple values into a file upload or email input.
|Specifies a minimum value for number and date input fields.
|Specifies a maximum value for number and date input fields.
|Specifies the id of a <datalist> element which provides a list of autocomplete suggestions for the input field.
|Specifies the height of an image input.
|Specifies the browsing context in which to open the response from the server after form submission. For use only on input types of “submit” or “image”.
|Specifies the HTTP method (GET or POST) to be used when the form data is submitted to the server. Only for use on input types of “submit” or “image”.
|Specifies how form data should be submitted to the server. Only for use on input types “submit” and “image”.
|Specifies the URL for form submission. Can only be used for type=”submit” and type=”image”.
|Specifies a form to which the input field belongs.
|Specifies that the input field should be in focus immediately upon page load.
|Defines a keyboard shortcut for the element.
|Specifies whether the browser should attempt to automatically complete the input based on user inputs to similar fields.
|Was used to specify a border on an input. Deprecated. Use CSS instead.
|Specifies whether a checkbox or radio button form input should be checked by default.
|Disables the input field.
|Specifies the maximum number of characters that can be entered in a text-type input.
|Was used to indicate the scripting language used for events triggered by the input.
|Specifies the name of an input element. The name and value of each input element are included in the HTTP request when the form is submitted.
|Specifies the width of the input in characters.
|Defines the source URL for an image input.
|Defines the input type.
|Defines an initial value or default selection for an input field.
Browser Support for autocomplete