Various HTML attributes provide unique features to a web page. One of these attributes is the HTML autocomplete attribute. This attribute is used to specify whether the HTML element should automatically fill in the input or not. By setting the autocomplete attribute to “on”, the browser will automatically complete the values that the user entered before.
<element autocomplete="on/off">
off
: The browser will not automatically complete entries when the value is set to “off”.
on
: The browser will automatically complete entries, using the previously saved data when the value is set to “on”.
This attribute can be used with different HTML elements such as:
<form>
<input>
<textarea>
<fieldset>
In the example given above, the autocomplete attribute at line 13 is added to the input field, which suggests values as the user types into the field.
Most of the values suggested for autocomplete depend on the browser. The values come from past values that were entered by the user before, but may also come from pre-configured values.
Implementing the autocomplete attribute in our application saves the users’ time spent on manually completing it. Therefore, this attribute helps in improving the overall user experience.