Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

HTML <input> autocomplete Attribute

❮ HTML <input> tag

Example

An HTML form where the username and password does NOT get autocompleted:

<form action="/action_page.php">
  <label for="username">Username:</label>
  <input type="text" id="username" name="username"><br><br>
  <label for="password">Password:</label>
  <input type="password" id="password" name="password" autocomplete="new-password"><br><br>
  <input type="submit">
</form>
Try it Yourself »

Definition and Usage

The autocomplete attribute specifies if browsers should try to predict the value of an input field or not. You can also specify which type of value you expect in the input field.


Browser Support

The numbers in the table specify the first browser version that fully supports the attribute.

Attribute
autocomplete 17.0 6.0 2.0 5.1 10.0

Tip: In some browsers you may need to activate an autocomplete function for this to work (Look under "Preferences" in the browser's menu).


Syntax

<input autocomplete="on|off|type-of-value">

Attribute Values

Value Description
on Default. Autocomplete is on (enabled)
off Autocomplete is off (disabled)
address-line1 Expects the first line of the street address
address-line2 Expects the second line of the street address
address-line3 Expects the third line of the street address
address-level1 Expects the first level of the address, e.g. the county
address-level2 Expects the second level of the address, e.g. the city
address-level3 Expects the third level of the address
address-level4 Expects the fourth level of the address
street-address Expects the full street address
country Expects the country code
country-name Expects the country name
postal-code Expects the post code
name Expects the full name
additional-name Expects the middle name
family-name Expects the last name
given-name Expects the first name
honoric-prefix Expects the title, like "Mr", "Ms" etc.
honoric-suffix Expects the suffix, like "5", "Jr." etc.
nickname Expects the nickname
organization-title Expects the job title
username Expects the username
new-password Expects a new password
current-password Expects the current password
bday Expects the full birthday date
bday-day Expects the day of the birthday date
bday-month Expects the month of the birthday date
bday-year Expects the year of the birthday date
sex Expects the gender
one-time-code Expects a one time code for verification etc.
organization Expects the company name
cc-name Expects the credit card owner's full name
cc-given-name Expects the credit card owner's first name
cc-additional-name Expects the credit card owner's middle name
cc-family-name Expects the credit card owner's full name
cc-number Expects the credit card's number
cc-exp Expects the credit card's expiration date
cc-exp-month Expects the credit card's expiration month
cc-exp-year Expects the credit card's expiration year
cc-csc Expects the CVC code
cc-type Expects the credit card's type of payment
transaction-currency Expects the currency
transaction-amount Expects a number, the amount
language Expects the preferred language
url Expects a we address
email Expects the email address
photo Expects an image
tel Expects the full phone number
tel-country-code Expects the country code of the phone number
tel-national Expects the phone number with no country code
tel-area-code Expects the area code of the phone number
tel-local Expects the phone number with no country code and no area code
tel-local-prefix Expects the local prefix of the phone number
tel-local-suffix Expects the local suffix of the phone number
tel-extension Expects the extension code of the phone number
impp Expects the url of an instant messaging protocol endpoint

❮ HTML <input> tag
×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.