How to disable autocomplete of an HTML input field ?
In this article, we will learn how to disable or off autocomplete features of a particular input field in HTML form. As we know that autocomplete feature is used to allow a browser whether to automatically complete filled the input data value based on the values that the user entered before. As the latest browsers supports enabled autocomplete by default. The autocomplete feature faster the process of filling the form. In case of low internet excess or session expired, if the autocomplete is enabled then the browser automatically filled the data values that the user entered before.
Autocomplete attribute take two values:
- on: It specifies that autocomplete is enabled.
- off: It specifies that the autocomplete is disabled.
If you want to disabled autocomplete feature then follow the approach which are given below:
- First we create an HTML document that contains an <input> tag.
- Use the <input> tag with autocomplete attribute
- Set the autocomplete attribute to value “off”.
Example: Below code demonstrates that a form has two input fields, one with autocomplete status is on and in the other field autocomplete feature is off.