In this section, we will learn what the autocomplete attribute is and how to use it.
What is autocomplete Attribute in HTML <input> Tag?
Browsers have history! They store the data we put in input fields you see on webpages. Later on when you try to fill another input field on a website, a little box with your previously typed data will appear down below that input field and you can simply pick any of those data instead of typing if it matches your need.
This is called browsers autocomplete feature.
The autocomplete attribute is used on <input> elements when we want to apply the autocomplete feature of browsers on them.
Note: you can use the autocomplete attribute on the following input types:
HTML autocomplete Attribute in <input> Tag Syntax:
<input type = “type” autocomplete =”on | off”>
<input> Tag autocomplete Attribute Values
The value of the autocomplete attribute is either “on” or “off”.
If the value is set to “on” that means the target field should use the autocomplete feature of the browser.
If the value is set to “off” that means the target field should not use the autocomplete feature of the browser.
Example: using autocomplete attribute in HTML <input> tag
See the Pen using autocomplete attribute in HTML <input> tag by Omid Dehghan (@odehghan) on CodePen.