by Sai gowtham

How to disable autocomplete for (html) Input

In this tutorial, we are going to learn about how to disable the autocomplete for the form input fields.

By default browser remembers the information when we submit a form by entering the data through the <input> fields, and tries to autocomplete or autofill if we enter text again in the certain fields.

These features are enabled by default, for the user privacy reasons you need to turn it off for the input fields like credit card pin and unique government identification numbers or other fields.

Disabling the autocomplete

To disable the autocomplete for an input field, add the autocomplete="off" to it.

Here is an example:

<input type="text" autocomplete="off" />

You can also disable autocomplete for an entire form like this:

<form autocomplete="off">

</form>

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
45,614 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
284,472 students enrolled
40 hours of video content
View Course
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
130,921 students enrolled
48.5 hours of video content
View Course