Definition
The autocomplete attribute specifies whether the browser can automatically populate <input> <form> elements.
Applicable Elements
The autocomplete attribute can be used with the following elements:
HTML <form> autocomplete Attribute
The <form> tag is used to create an HTML form that contains controls for submitting user information.
The autocomplete attribute when used with the <form> element, specifies whether the browser can automatically populate all <input> elements on the <form>.
Syntax
<form action="" method="get" autocomplete="on"></form>Usage
- The
autocompleteattribute has two states;onoroff. - If the
autocompleteattribute value is missing or invalid, the default state ison. - If autocomplete is enabled, the browser may automatically complete entries as the user is typing.
- Some browsers may ignore the
offsetting for suspected login forms.
Values
Values can include:
offon- If the value is missing or invalid, it defaults to
on.
Examples
The example shows the autocomplete attribute applying to all applicable <form> elements. In this case, it includes the two <input> elements with the text attribute.
<form action="" method="get" class="form" autocomplete="on">
<fieldset class="fieldset">
<label for="name">Name: </label>
<input type="text" name="name" id="name">
<label for="address">Address: </label>
<input type="text" name="address" id="address">
</fieldset>
<div class="form-example">
<input type="submit" value="Subscribe!">
</div>
</form>HTML <input> autocomplete Attribute
The <form> tag is used to create an HTML form that contains controls for submitting user information.
The autocomplete attribute, when used with the <input> element, specifies whether the browser can automatically populate a singular <input> element on the <form>.
Syntax
<input type="text" name="name" id="name" autocomplete="on">Usage
- The
autocompleteattribute has two states;onoroff. - It the
autocompleteattribute value is missing or invalid, the default state ison. - If autocomplete is enabled the browser may automatically complete entries as the user is typing.
- Some browsers may ignore the
offsetting for suspected login forms. - The
autocompleteattribute works with the following<input>types:emailtelpasswordtextsearchurldatepickersrangecolor
Values
Values can include:
offon- If the value is missing or invalid, it defaults to
on.
Examples
The example shows the autocomplete attribute applying to a singular <input> element in the <form>.
<form action="" method="get" class="form">
<fieldset class="fieldset">
<label for="name">Name: </label>
<input type="text" name="name" id="name" autocomplete="on">
<label for="address">Address: </label>
<input type="text" name="address" id="address">
</fieldset>
<div class="form-example">
<input type="submit" value="Subscribe!">
</div>
</form>Specification
The autocomplete HTML specification for each of the following elements is below:
<form>,<input>
Browser Support
The autocomplete has the following browser support:
Desktop
| Chrome | Edge | Firefox | IE | Opera | Safari | |
|---|---|---|---|---|---|---|
<form> | Yes | Yes | Yes | Yes | Yes | Yes |
<element> | Yes | Yes | Yes | Yes | Yes | Yes |
Mobile
| Android Webview | Chrome Android | Firefox Android | Opera Android | iOS Safari | Samsung Internet | |
|---|---|---|---|---|---|---|
<form> | Yes | Yes | Yes | Yes | Yes | Yes |
<element> | Yes | Yes | Yes | Yes | Yes | Yes |
