【html】解决input标签自动填充账号密码问题

70 阅读1分钟

亲测有效

背景:

浏览器有时会对type为password类型的input自动填充密码,并把前面type为text类型的input(不为readOnly)当成了"账号"项进行填充。在有些场景下,此功能会出现错误的展示,为了有效解决当前问题,对比了各种解决办法,以下办法验证是有效方法。

<div>
    <input type="text" name="text" style="width: 0;height: 0;border: none;padding: 0;">
    <input type="password" name="password" style="width: 0;height: 0;border:none;padding: 0;">
<div>