Friday, July 10, 2015

Disable autocomplete in Chrome

Originally when I was given the task to disable autocomplete. I thought it would be no problem, but that was far from reality. I tried adding autocomplete="off" to the input tag but it continued to show in chrome. Although, it did seemed OK in IE and Firefox. After a few hours of frustration. I decided to use "false" as the value instead of "off" which resolved the issue. Below is a snippet of the working code. 


//Use this for IE
autocomplete="off"

//Use this for Chrome
autocomplete="false"


//Form Example
// You can also add it to the form so you won't need to add it individually.
<form id="form1">
<input id="txtName" type="text" autocomplete="false" />
<input id="txtEmail" type="text" autocomplete="false" />
<input id="btnSubmit" type="button" value="Submit" />
</form>

No comments:

Post a Comment