自动完成不HTML工作铬(Autocomplete is not working in html w

2019-10-30 10:35发布

有时,在我的web应用程序,即使我声明form autocompleteoff有时它不工作,它autocomplete我在输入类型。

任何人都可以知道如何的方式解决这类疑难问题使用Chrome的。

我的代码示例:有时它的autocompleting我的投入甚至我宣布关闭已..

<form autocomplete="off" method="post">
    <input autocomplete="off" type="text" name="name">
    <input autocomplete="off" type="text" name="age">
    <input type="submit" >
</form>

Answer 1:

<form autocomplete="off" method="post">
<input autocomplete="off" type="text" name="name"  value="">
<input autocomplete="off" type="text" name="age"  value="">
<input type="submit" >
</form>


Answer 2:

解决方法很简单,并在所有的浏览器完美的工作。

  1. 添加禁用和自动完成=“关闭”属性的表单字段(姓名,年龄等)

     <form method="post"> <input disabled="disabled" autocomplete="off" type="text" class="name" name="name"> <input disabled="disabled" autocomplete="off" type="text" class="age" name="age"> <input type="submit" > </form> 
  2. 在页面加载使几毫秒后的字段。

使用下面的JS代码

function getRidOffAutocomplete(){               
    var timer = window.setTimeout( function(){
        $('.name, .age').prop('disabled',false);
            clearTimeout(timer);
        }, 800);
    }

// Invoke the function
getRidOffAutocomplete();


Answer 3:

这是不是一个错误- autocomplete不支持Chrome的更多。 这是由开发设计决策,你应该设计为它而不是试图解决它。 见我回答这个非常类似的问题 。



文章来源: Autocomplete is not working in html with chrome