1. 程式人生 > >解決 Chrome 表單 自動填充的問題

解決 Chrome 表單 自動填充的問題

自動填充 本身的是chrome的一個功能 

解決這個問題 其實 花費了好長時間,網上新增什麼欄位 其實都沒什麼屁用,該自動填充的 還是繼續填充

使用 js 在 清空 表單內容 ,發現也沒有什麼用

最後也不知道什麼 靈機一動: 

不如將 下面的 password 型別的 input 型別 改成 text ,

然後等到 onfocus 將其型別 改成 password

<input type="password" style="width:0;height:0;float:left;visibility:hidden"/>
<input type="text" class="form-control" placeholder="新密碼" name="newpassword" >
$("input[name='newpassword']").focus(function(){
    $(this).attr("type","password");
 })

需要有兩個 input 這樣 focus 後 才不會重新填充