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'">  
  • 相关阅读:
    作业II
    7.26 tar命令
    7.24
    网络003
    网络002
    网络001
    MySQL基于amoeba读写分离实验
    MYSQL数据库之主从复制及读写分离
    MySQL的主从异步复制实验
    MYSQL数据库扩展 索引与事务与引擎
  • 原文地址:https://www.cnblogs.com/dandeliongogo/p/6667607.html
Copyright © 2011-2022 走看看