zoukankan      html  css  js  c++  java
  • input标签在谷歌浏览器记住密码下的一个自动填充BUG

    Chrome自带记住密码功能,带来了极大方便

    但是在点击保存之后,input标签会自动填充所保存的密码,如下图:

    而且填充得很乱,密码不一定就会填充在密码框里。解决这一个BUG,可以用下面这个方案:

    例如我们有个input标签:

    1 <input type="text" class="test" id="test"> 

    首先在这个input标签上面加一个display为none的input标签

    1 <input type="text"style="display: none">  
    2 <input type="text" class="test" id="test">

    然后为input加一个autocomplete="off"的属性,此属性是 HTML5 的新属性,自动完成允许浏览器预测对字段的输入,但是只只用于text, search, url, telephone, email, password, datepickers, range 以及 color类型的<input>和<form>,所以如果我们需要一个密码框,需要给input设置一个onfocus="this.type='password'" 

    1 <input type="text" class="test" id="test" style="display: none";>  
    2 <input type="text" class="test" id="test" placeholder="请输入密码" autocomplete="off" onfocus="this.type='password'">  
  • 相关阅读:
    关闭ThinkPHP Runtime Log
    Robots协议的写法
    Getif工具获取 交换机的OID/Zabbix设置
    命令方式启动 vmware 虚拟机
    wireshark 抓包使用教程
    Sniffer 交换机端口抓包
    H3C 开启ssh/snmp
    Apache Superset BI
    洛谷5588 小猪佩奇爬树
    luogu5536 核心城市
  • 原文地址:https://www.cnblogs.com/dandeliongogo/p/6667607.html
Copyright © 2011-2022 走看看