javascript 输入元素应具有自动完成属性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/54970352/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Input elements should have autocomplete attributes
提问by vinayak shahdeo
I am getting this message in the console I can't understand it. Please look into it
我在控制台中收到此消息,我无法理解。请调查一下
<!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>
The problem is despite no error I keep getting this message
问题是尽管没有错误我一直收到这条消息
[DOM] Input elements should have autocomplete attributes (suggested: "current-password"):
?
?
I have been provided with a google link in console which take me to (More info: goo.gl/9p2vKq)
我在控制台中得到了一个谷歌链接,可以带我去(更多信息:goo.gl/9p2vKq)
回答by dearsina
Try changing <input type="password" name="password">to <input type="password" name="password" autocomplete="on">
尝试更改<input type="password" name="password">为<input type="password" name="password" autocomplete="on">
Autocompletelets web developers specify what if any permission the user agent has to provide automated assistance in filling out form field values, as well as guidance to the browser as to the type of information expected in the field.
自动完成让 Web 开发人员可以指定用户代理必须提供哪些权限,以便在填写表单字段值时提供自动帮助,并为浏览器提供有关该字段中预期信息类型的指导。
It's pretty powerful.
它非常强大。
回答by shotgun02
Its in chrome.. It is to ensure that browsers' and extensions' password management functionality can understand your site's sign-up, sign-in and change-password forms by enriching your HTML with a dash of metadata.
它在 chrome 中。它是为了确保浏览器和扩展程序的密码管理功能可以通过使用少量元数据丰富您的 HTML 来理解您站点的注册、登录和更改密码表单。
this might help you https://www.chromium.org/developers/design-documents/form-styles-that-chromium-understands
这可能对您有帮助 https://www.chromium.org/developers/design-documents/form-styles-that-chromium-understands

