Just use the autocomplete attribute:
<input name="q" type="text" autocomplete="off"/>
This would be useful when a text input is one-off and unique. Like a CAPTCHA input, one-time use codes, or for when you have built your own auto-suggest/auto-complete feature and need to turn off the browser default.
To make your web application iPhone and iPad friendly, you can also control whether or not automatic correction or capitalization is used in your form’s input fields. This can come in handy for username fields. Do so by implementing code along the following lines:
To turn off autocorrect:
<input type="text" name="some_name" autocorrect="off"></input>
To turn off autocapitalize:
<input type="text" name="some_name" autocapitalize="off"></input>
That is a very good snippet! Thanks!
Use in the tag form autocomplete=”off” ..
autocomplete=”off” is not valid markup with XHTML Transitional, which is a common DOCTYPE. Use this to keep a vaild markup
if (document.getElementsByTagName) {
var inputElements = document.getElementsByTagName(“input”);
for (i=0; inputElements[i]; i++) {
if (inputElements[i].className && (inputElements[i].className.indexOf(“disableAutoComplete”) != -1)) {
inputElements[i].setAttribute(“autocomplete”,”off”);
}
}
}
it worked for me for safari mobile..thanks buddy
Nice Script working Fine,
Thank You!
thx a lot u solved my problem :)
Thank You…The Javascripts works for me :)
asfsda
Is there anyway to style the autocomplete? (without js)
I have seen:
But it is not working and only for webkit browsers. I have a large font-size for “placeholder=”blabla” and need autocomplete. The autocomplete with this font size is look horrific…
So:
:)
The autofill feature on iOS not always work based on the site being surfed. I have web application when browsed on iPad the autofilll does not work. Is there any trick to enable it? Please advise
There is a small issue using, when the page is validated with w3c validator it shows error “there is no attribute “autocomplete””
I ask stackexchange.com to add this feature providing a link to your blog article: http://meta.stackoverflow.com/q/148009/195437
Add form Tag autocomplete=”off” you don’t need add individual input tag for auto complete off
Probably not a good idea if your visitors use Chrome, kunal.
See http://stackoverflow.com/questions/7973462/chrome-ugly-message-when-autofill-is-disabled.
Thanks, autocomplite attribute is part of HTML5 works with the following <input> types: text, search, url, tel, email, password, datepickers, range, and color.
Just tried adding autocomplete=off to each input field – that didn’t work, but adding it to whole form does.
i.e.
input autocomplete="off" /
– no go,form autocompete="off"
– works…unless there’s something wrong with my browser(s).Well, now your input controls will not COMPETE with one another, ha!
ust tried adding autocomplete=off to each input field – that didn’t work, but adding it to whole form does.
i.e. input autocomplete=”off” / – no go, form autocompete=”off” – works…unless there’s something wrong with my browser(s).
Great! you save my time. Thanks a lot. But one more thing, its not w3c valid attribute. What should we do to get validation but still using autocomplete off feature? Thanks in advance.
Guys it’s not working, if I use the Jquery method to turn off the autocomplete feature :(
I have to swap the username and password fields. And let the username float left. Otherwise, the username and password are auto filled.
Hi
I am facing the problem where if we click on add new user form in my application, Firefox autofills username and password with administrator username and password. How did you solved this? Can you please explain. I need to urgently implement this.
I know your going to laugh, but where do I enter that? (<input…..)? I would really like to disable autocomplete in my browsers, and I can't get it right on the registry.
none of the above solutions worked for me. :(
Chrome seems to be ignoring the autocomplete attribute as of version 34.
Removing
$(document).ready...
worked for me :)I have set the attribute of autocomplete=”off”. But safari browser autocomplete is working. How to slove the autocomple off problem?!!
If you need to disable autocomplete for a password field, feel free to use a plugin I created: https://github.com/say2joe/jquery.disable-autocomplete
Nice snippet! Thanks!
Setting the autocomplete attribute to “off” does not disable Chrome autofill in more recent versions of Chrome. Instead you must set autocomplete on each input as follows
<input autocomplete="smartystreets">
you can set autocomplete to anything besides “on” or “off” and it will disable Chrome autofill
amazing.. saved me a little hair pulling. Chrome was messing with my live filter and this trick fixed it.
None of the above works. I tried setting autocomplete=off, I tried setting the meta tag to no cache, I tried programatically setting the values with jquery and I tried to explicitly setting the value to nothing. Why is nothing possible when we need this simple functionality? It is a time thief that html, css and javascript are so lousy tools they can’t even make the simple things simple. This is a simple task so it should be simple and there should be one obvious solution so where is the obvious solution?
Not sure if you’re still looking for a solution, but I was in the same boat, spent a few hours on this 1 BS problem, and finally found this solution that worked:
Literally just put those two fake fields above your actual input fields in your form and chrom will autofill those instead. Problem solved! :D
originally found here:
http://www.tech.theplayhub.com/disabling_chrome_autofill/
My previous comment ended up no longer working as well, but there was another comment later down the list of comments that did work for me:
This basically makes it so that the field is locked until you click in there. This worked every time for me without having any of the other workarounds in place (of which I had tried them all, even salting the url string and autocomplete fields with random numbers!)
thank u clint!!! this really works for me!!!
Awesome..!! You are Gem..!!
This will not work in all cases. for example name text field and then password field set to readonly. Once you click the the password readonly field you now have made it not readonly, then if you go back and auto-fill the previous name field the password field will be auto-filled.
I’d much sooner use jQuery to do this:
// Remove auto inputs on mobile
$(‘.ginput_container input’).attr({
autocomplete: “off”,
autocapitalize: “off”,
autocorrect: “off”
});
It’s far simpler than all solutions. Go to stackoverflow and there’s one perfect suggestion:
Instead of autocomplete=”off” use autocomplete=”false”
and it works.
Hi autocomplete is working fine, but the autocomplete bar(that sits above the android keypad still exists without autocomplete text. Can any one please suggest me how do I hide it using JAVASCRIPT and CSS.
Hi autocomplete is working fine, but the autocomplete bar(that sits above the android keypad still exists without autocomplete text, that hides the login button so) Can any one please suggest me how do I hide it using JAVASCRIPT and CSS.
Why Don’t Everyone Use This….
It’s So Simple… :)
So you mean that each time I re-focus an element, I have to re-enter its value?
Hello ,
the whole page autocomplete off is by applying this “autocomplete=off” into the form-tag.
that’s it.
Thanks to all
This trick doesn’t work any more for password fields. Browsers are ignoring autocomplete.
you can avoid passwords autocomplete by adding
autocomplete="new-password"
to the password fieldTry autocomplete=”false”
Using fake input field at the beginning of the form works for me.
You need to put them as
visibility: hidden
otherwise Chrome and FF will ignore it.This does not work in current firefox.
Using fake input field at the beginning of the form works for me.
You need to put them as
visibility: hidden
otherwise Chrome and FF will ignore it.Hi,
Thanks this worked. But I used
display: none
instead ofvisibility: hidden
so that the element won’t take space on the page.Thanks again!! :)
autocomplete=”false” works so long as ALL text input fields are NOT set as autocomplete=”false”. I have to leave at least one input field as able to be autocompleted. setting all to false negates the action. setting the form itself to autocomplete=”false” or “off” doesnt work for me.
How to disable keyboard popup when we click on text input focus without text text input readonly?
autocomplete=”new-password”
100% IT WORKS IN CHROME.
it does not work for for chrome 63
You can try jQuery disableAutoFill Plugin.
https://github.com/terrylinooo/jquery.disableAutoFill
All those still facing this issue, remove the form tag and issue is solved. use other methods to submit your form. autocomplete shows suggestions for inputs within form tag
Does anyone know how to remove this now in Chrome v71? It seems Chrome remove support for autocomplete=”off” or autocomplete=”false”. Even autocomplete=”new-password” doesn’t work anymore.
I’m using an input to do a jquery filtering, but the autocomplete box in chrome keeps going over my dropdown.
Hello. I’ve been looking for this for a while. I’m using WordPress. Do I put this is the functions.php file of the child theme? If not, where do I place all these codes?
Also, to confirm, will this prevent all customers in their device from autofilling the fields on our site?
don’t know why but setting autocomplete attribute to “off” doesn’t worked for me in google Chrome
Hello.
My plugin jQuery disableAutoFill Plugin.
https://github.com/terrylinooo/jquery.disableAutoFill is abandoned. New version is a vanilla JavaScript library called disableautofill.js
Here is the link: https://github.com/terrylinooo/disableautofill.js