vin*_*deo 0 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>
Run Code Online (Sandbox Code Playgroud)
问题是尽管没有错误,但我一直收到此消息
[DOM] Input elements should have autocomplete attributes (suggested: "current-password"):
Run Code Online (Sandbox Code Playgroud)
?
我在控制台中获得了google链接,可将我带到(更多信息:goo.gl/9p2vKq)
RIC*_*HAM 15
您可以使用以下选项来处理以下格式的错误输入元素应具有控制台通过修改抛出的自动完成属性:
<input type="password" name="password">
Run Code Online (Sandbox Code Playgroud)
autocomplete为offat the<form>或<input>which:
<input type="password" name="password" autocomplete="off">
Run Code Online (Sandbox Code Playgroud)
<input type="password" name="password" autocomplete="new-password"> <!-- For Mozilla-->
<!-- or -->
<input type="password" name="password" autocomplete="current-password"> <!-- For Chrome-->
Run Code Online (Sandbox Code Playgroud)
自动完成属性可帮助密码管理器推断表单中字段的用途,从而避免意外保存或自动填充错误的数据。
autocomplete您可以在需要由密码管理器管理的 HTML 元素上使用该属性来自动填充其值。属性的值autocomplete取决于您想要向密码管理器传达更多信息的字段。考虑以下示例:
autocomplete="current-password"autocomplete="new-password"autocomplete="cc-number"尝试更改<input type="password" name="password">为<input type="password" name="password" autocomplete="on">
通过自动完成功能,Web开发人员可以指定用户代理在填写表单字段值时是否必须提供自动协助(如果有任何权限)以及向浏览器提供有关该字段中预期信息类型的指导。
它非常强大。
| 归档时间: |
|
| 查看次数: |
3069 次 |
| 最近记录: |