浏览器控制台警告错误[DOM] Password field is not contained in a form:或者是 input 警告[DOM]...

前端编写代码时,查看浏览器控制台会出现的警告错误[DOM] Password field is not contained in a form:或者是 input 警告[DOM] Input elements should have autocomplete attributes (suggested: “new-password”)

1, 出现警告错误[DOM] Password field is not contained in a form:的解决方法是:
在input标签外添加上标签form

<div class="form-group">
              <form>
              密码:
              <input type="password" class="form-control" id="exampleInputPassword1" name="password" placeholder="请输入密码"/>
              </form>
            </div>

2, 出现 input 警告[DOM] Input elements should have autocomplete attributes (suggested: “new-password”)的解决方法:
添加placeholder属性——作用:规定输入字段是否应该启用自动完成功能

<div class="form-group">
              <form>
              密码:
              <input type="password" class="form-control" id="exampleInputPassword1" name="password" placeholder="请输入密码" autocomplete="off"/>
              </form>
            </div>

你可能感兴趣的:(chrome,javascript,html)