Turn Off Autocomplete for Input
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”);
}
}
}
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:
#inputId:-webkit-autofill {
background-color: white !important;
} (bug)
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:
.search_field{font-size: 1.5em;} (input)
.search_field:-webkit-autofill{font-size: .9em;}(autofill)
:)
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.