[DOM] input 警告[DOM] Input elements should have autocomplete attributes(suggested:“current-password)

54 篇文章 3 订阅
34 篇文章 7 订阅

警告信息:

这个虽然不影响效果,但是有的时候自动填充密码时会把密码带出来

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

意思为:输入元素应具有自动完成属性

  <input type="password" />

定义和用法

autocomplete 属性规定输入字段是否应该启用自动完成功能。

自动完成允许浏览器预测对字段的输入。当用户在字段开始键入时,浏览器基于之前键入过的值,应该显示出在字段中填写的选项。

注释:autocomplete 属性适用于 <form>,以及下面的 <input> 类型:text, search, url, telephone, email, password, datepickers, range 以及 color。

 

autocomplete属性值

描述
on默认。规定启用自动完成功能。
off规定禁用自动完成功能。

w3c autocomplete文档 

 解决方案:

只需要加上这个属性就行autocomplete

1.原生js,vue

  <input type="password" autocomplete/>

2.react里属性都为驼峰autoComplete

<input type="password" autoComplete=""/>
//或者
<input type="password" autoComplete="on"/> //以及off都行

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

崽崽的谷雨

漫漫前端路,摸爬滚打

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值