--- title: The HTML autocomplete attribute slug: Web/HTML/Atributos/autocomplete translation_of: Web/HTML/Attributes/autocomplete ---
El atributo autocomplete
está disponible en varios tipos de {{HTMLElement("input")}} aquellos que toman un texto o valor numérico como entrada. autocomplete
permite a los desarrolladores web especificar qué permisos si los hay {{Glossary("user agent")}} debe proporcionar asistencia automatizada para completar los valores de los campos de formulario, así como una guía para el navegador en cuanto al tipo de información que se espera en el campo.
Los valores sugeridos generalmente depende del navegador. Normalmente, provienen de valores ingresados por el usuario, pero también pueden provenir de valores preconfigurados. Por ejemplo, un navegador puede permitir que el usuario guarde su nombre, dirección, número de teléfono y direcciones de correo electrónico para autocompletar así como también datos de tarjetas de crédito.
Si un elemento {{HTMLElement("input")}} no tiene el atributo autocomplete
, entonces los navegadores usan el atributo autocomplete
del {{HTMLElement("form")}} que lo contiene. En otras palabras, el {{HTMLElement("form")}} del que el {{HTMLElement("input")}} desciende. También puede ser especificado en el atributo {{htmlattrxref("form", "input")}} del {{HTMLElement("input")}} en cuestión.
Para más información vea el atributo {{htmlattrxref("autocomplete", "form")}} del elemento {{HTMLElement("form")}}
Para proveer el autocompletado, el navegador necesita del los elementos <input>
:
name
y/o id
<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.