How to remove auto-complete from form inputs

November 16, 2021

How to remove auto-complete from form inputs

In this article, we will learn how to remove auto-complete from form inputs of HTML, in a simple way using a native attribute of the language itself.

remove auto-complete from form inputs cover

Hey you programmer, okay? Let’s learn something new!

Auto complete is a sensational feature, it helps users who have already filled in data on another site to retrieve them and use them on other sites

But it can often cause a problem, so how can we fix it?

The answer is quite simple, we need to use an attribute called autocomplete in the form

And then set the value of this attribute to off, see the example:

<!DOCTYPE html>
  <title>Como remover o auto complete de inputs</title>
  <h1>Preencha o formulário</h1>
  <form autocomplete="off">
   <input type="email" name="email" placeholder="Digite seu e-mail">
   <input type="password" name="password" placeholder="Digite sua senha">
   <input type="submit" value="Login">

We have a login form, and as mentioned before it has the autocomplete attribute with a value set to off

This will cause the functionality to be disabled in this form, thus solving our problem

Remembering that you should use this wisely, as taking a resource from the user can be very harmful to your system

Always think carefully about his journey, when changing a default or expected behavior that he might miss

And besides, always try to opt for native solutions like this one, don’t mess around with JavaScript

Because it can lead to code that is difficult to read and bad to maintain, always think about the next one that will take this code


In this article we learned a way to remove auto-complete from form inputs of HTML

We simply add the autocomplete attribute with an off value to the form tag and the problem will be solved

Want to improve your HTML skills? Click here!

Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x