javascript - 输入元素应该有自动完成属性

标签 javascript php jquery google-chrome

我在控制台收到这条消息,我无法理解。请看一下

    <!DOCTYPE html>
<html>
<head>
    <title>registration page</title>
        <script src="js/jquery.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
        $('form').submit(function(event){
    "use strict";
        var valid = true,
        message = '';    
            $('.error').remove();           
   $('form input').each(function() {
        var $this = $(this);   
        if(!$this.val()) {
            message='';
            var inputName = $this.attr('name');
            valid = false;
            message += 'Please enter your ' + inputName + '\n';
            $(this).closest('div').append('<div class="error">'+message+'</div>');           
        }
})
           if(!valid){
                event.preventDefault();
        }else{
$('form').serialize()
        }
})
})
    </script>
</head>
<body>
<form>
<div>
    <label>Name</label>
    <input type="text" name="name"><br>
</div>
<div>
    <label>File</label>
    <input type="file" name="file"><br>
</div>
<div>
    <label>password</label>
    <input type="password" name="password"><br>
</div>
<button type='submit'>Submit</button>
</form>
</body>
</html>

问题是尽管没有错误我还是不断收到这条消息

[DOM] Input elements should have autocomplete attributes (suggested: "current-password"): 

我在控制台中获得了一个谷歌链接,可以将我带到 (More info: goo.gl/9p2vKq)

最佳答案

尝试改变

<input type="password" name="password">

<input type="password" name="password" autocomplete="on">

Autocomplete允许 Web 开发人员指定用户代理必须获得哪些(如果有)权限,以便在填写表单字段值时提供自动协助,以及就字段中预期的信息类型向浏览器提供指导。

它非常强大。

关于javascript - 输入元素应该有自动完成属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54970352/

相关文章:

javascript - 在html中用javascript解析xml

javascript - CSS/HTML/JS 用下拉搜索预览排列 div

javascript - 将表达式拆分为具有多个键的数组,并在数组中包含键

php - 将多个字段的值相加然后插入 php 中的 MySQl 列

php - 使用 ORDER BY 按值排序?

javascript - 更改另一个 div 鼠标悬停上的多个 div 内容,无需 css/使用 xml 源文件

jquery - 带有 CORS 的 IE9 jQuery AJAX 返回 "Access is denied"

javascript - 粘贴大文件

php - 无法从 woocommerce 产品循环 Hook /操作中删除 sale_flash 徽章

jquery - 如何从0而不是最大值开始计数器?