Disable autofill on a web form through HTML or JavaScript?

懵懂的女人 提交于 2019-11-28 00:42:46

You can do it at the input level in HTML by adding "autocomplete="off" to the input.

http://css-tricks.com/snippets/html/autocomplete-off/

You could also do it via JS such as:

someForm.setAttribute( "autocomplete", "off" ); 
someFormElm.setAttribute( "autocomplete", "off" );

jQuery one:

$(".indication-checkbox").attr("autocomplete", "off");

In fact autocomplete off doesn't always work in newer browsers. E.g in Chrome it is ignored if the autofill property is set. See the link: http://caniuse.com/#feat=input-autocomplete-onoff

Anand Dwivedi

You can use this code:

$(".TextID").attr("autocomplete", "off"); //disable input level 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!