The HTML autocomplete
attribute is available on several kinds of <input>
elements—those that take a text or numeric value as input. autocomplete
lets web developers specify what if any permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field.
The source of the suggested values is generally up to the browser; typically values come from past values entered by the user, but they may also come from pre-configured values. For instance, a browser might let the user save their name, address, phone number, and email addresses for autocomplete purposes. Perhaps the browser offers the ability to save encrypted credit card information, for autocompletion following an authentication procedure.
If an <input>
element has no autocomplete
attribute, then browsers use the autocomplete
attribute of the element's form owner, which is either the <form>
element that the <input>
element is a descendant of, or the <form>
whose id
is specified by the form
attribute of the <input>
element.
For more information, see the autocomplete
attribute in <form>
.
"off"
autocomplete
to "off"
will not prevent a password manager from asking the user if they would like to save username and password information, or from automatically filling in those values in a site's login form. See the autocomplete attribute and login fields."on"
"name"
"name"
rather than breaking the name down into its components is generally preferred because it avoids dealing with the wide diversity of human names and how they are structured; however, you can use the following autocomplete
values if you do need to break the name down into its components: "honorific-prefix"
"given-name"
"additional-name"
"family-name"
"honorific-suffix"
"nickname"
"email"
"username"
"new-password"
"current-password"
"organization-title"
"organization"
"street-address"
"address-line1"
, "address-line2"
, "address-line3"
"street-address"
is also present."address-level4"
"address-level3"
"address-level2"
"address-level1"
"country"
"country-name"
"postal-code"
"cc-name"
"cc-given-name"
"cc-additional-name"
"cc-family-name"
"cc-number"
"cc-exp"
"cc-exp-month"
"cc-exp-year"
"cc-csc"
"cc-type"
"transaction-currency"
"transaction-amount"
"transaction-currency"
, of the transaction, for a payment form."language"
"bday"
"bday-day"
"bday-month"
"bday-year"
"sex"
"tel"
"tel-country-code"
"tel-national"
"tel-area-code"
"tel-local"
"tel-local-prefix"
for "555" and "tel-local-suffix"
for "6502"."tel-extension"
"impp"
"url"
"photo"
See the WHATWG Standard for more detailed information.
Note: The autocomplete
attribute also controls whether Firefox will — unlike other browsers — persist the dynamic disabled state and (if applicable) dynamic checkedness of an <input>
across page loads. The persistence feature is enabled by default. Setting the value of the autocomplete
attribute to off
disables this feature. This works even when the autocomplete
attribute would normally not apply to the <input>
by virtue of its type
. See bug 654072.
The four administrative level fields ("address-level1"
through "address-level4"
) describe the address in terms of increasing levels of precision within the country in which the address is located. Each country has its own system of administrative levels, and may arrange the levels in different orders when addresses are written.
"address-level1"
always represents the broadest administrative division; it is the least-specific portion of the address short of the country name.
Given that different countries write their address in different ways, with each field in different places within the address, and even different sets and numbers of fields entirely, it can be helpful if, when possible, your site is able to switch to the layout expected by your users when presenting an address entry form, given the country the address is located within.
The way each administrative level is used will vary from country to country. Below are some examples; this is not meant to be an exhaustive list.
A typical home address within the United States looks like this:
432 Anywhere St
Exampleville CA 95555
In the United States, the least-specific portion of the address is the state, in this case "CA" (the official US Postal Service shorthand for "California"). Thus "address-level1"
is the state, or "CA" in this case.
The second-least specific portion of the address is the city or town name, so "address-level2"
is "Exampleville" in this example address.
United States addresses do not use levels 3 and up.
The UK uses one or two address levels, depending on the address. These are the post town and, in some instances, the locality.
China can use as many as three administrative levels: the province, the city, and the district.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete