html禁用自动完成,html – 如何禁用所有主流浏览器的自动完成功能
生活随笔
收集整理的這篇文章主要介紹了
html禁用自动完成,html – 如何禁用所有主流浏览器的自动完成功能
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
自動填充應使用以下< input>類型:文本,搜索,網址,電話,電子郵件,密碼,日期選擇器,范圍和顏色.
但是,你可以嘗試在你的< form>中添加autocomplete =’off’.標記而不是< input>標簽,除非有什么東西阻止你這樣做.
如果這不起作用,您也可以使用JavaScript:
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”);
}
}
}
或者在jQuery中:
$(document).ready(function(){
$(':input').live('focus',function(){
$(this).attr('autocomplete', 'off');
});
});
總結
以上是生活随笔為你收集整理的html禁用自动完成,html – 如何禁用所有主流浏览器的自动完成功能的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Flutter学习笔记(15)--Mat
- 下一篇: html5音频文件生成波形图代码,HTM