This question already has an answer here:
- Disabling Chrome Autofill 69 answers
How can we disable Chrome's autofill feature on certain <input>
s to prevent them from being automatically populated when the page loads?
At the same time I need to keep autocomplete enabled, so the user can still see the list of suggestions by clicking on the input or typing in it. Can this be done?
EDIT: Feel free to use plain Javascript or jQuery if you feel it is necessary or you feel like it would make your solution simpler.
Chrome password manager is looking for input elements with
type="password"
and fill in saved password. It also ignoresautocomplete="off"
property.Here is fix for latest Chrome (Version 40.0.2181.0 canary):
JS:
After a lot of struggle, I have found that the solution is a lot more simple that you could imagine:
Instead of
autocomplete="off"
just simply useautocomplete="false"
;)Try this...
I was recently faced with this problem, and with no simple solution since my fields can be prepopulated, I wanted to share an elegant hack I came up with by setting password type in the ready event.
Don't declare your input field as type password when creating it, but add a ready event listener to add it for you:
http://jsfiddle.net/
Here's the magic you want:
Chrome intentionally ignores
autocomplete="off"
andautocomplete="false"
. However, they putnew-password
in as a special clause to stop new password forms from being auto-filled.I put the above line in my password input, and now I can edit other fields in my form and the password is not auto-filled.
A little late, but here's my fool proof solution useful for pages like the sign up/registration page where the user has to input a new password.
Chrome will detect two password inputs and will not auto fill the password fields. However, the field id="password_fake" one will be hidden via CSS. So the user will only see one password field.
I've also added some extra attributes "x-autocompletetype" which is a chrome experimental specific auto fill feature. From my example, chrome will autofill in the first name, last name and email address, and NOT the password field.
autocomplete="off"
on the input now working on Chrome V44 (and Canary V47)