我在控制台收到这条消息,我无法理解。请看一下
<!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/