Prevent Chrome autocomplete form, does not work autocomplete="off" in input


Good morning, I'm having problems with Google Chrome and the autocomplete. I do not want some fields of my form to be autocompleted and I added the attribute: autocomplete="off"

This in Chrome is not working, but in other browsers such as Firefox if How can I prevent only some fields from being completed?

I have seen by internet as an alternative solution to add autocomplete="off" to the label <form> , but this does not work for me, since many fields if I would like them to be autocompleted ...

<form id="formulario" action="" method="">
<input type="text" name="nombre" placeholder="Nombre..." />
<input type="text" name="apellidos" placeholder="Apellidos..." />
<input type="email" name="email" placeholder="Correo electrónico..." />
<input type="text" name="codigo" placeholder="Código promocional..." autocomplete="off" />

How do I prevent a single input field from being autocompleted in Chrome?

asked by Norak 05.01.2018 в 13:24

2 answers


Because the autocomplete problem of Google Chrome is well known and has been discussed in numerous forums by users who have had this problem, a kind of "patch" (if you can say it) to fix what chrome is prohibited. The default design is set to ignore the autocomplete ("autocomplete = off") instruction. This "patch" that solves your problem shows you @sergibarca in your answer.

As a add-on , I should add that you could make chrome try to find a non-existent code by setting the autocomplete > from the input in question to a value you know will never exist in the field. This way chrome will not be able to show you any autocomplete option because it does not find any that matches the autocomplete.

This is achieved in your case like this:

<input type="text" name="codigo" placeholder="Código promocional..." autocomplete="ÑÖcompletes" />

Hardly chrome will find autocomplete something that matches "ÑÖcompletes" . Of course, you can change this value for something that is more elegant or that suits you better!


For the patch. Here!

For autocomplete with nonexistent value: Here!

To observe both responses to a problem similar to yours: Here

Bonus, Mozilla also happened! Here!

That's it. A greeting

answered by 05.01.2018 / 16:14

What you could do is create an input that captures the complete car hidden with CSS.


<input style="display:none" type="text" name="falsocodigo" autocomplete="off" />

<input type="text" name="codigo" placeholder="Código promocional..." autocomplete="off" />
answered by 05.01.2018 в 13:32