取消瀏覽器的自動填充密碼的一種方式

1、添加隱藏控件,類型爲password

2、真正的密碼框設置autocomplete="off",並將type設置爲text,然後在獲取焦點的時候改變type爲password

<div class="form-group">
    <input id="txtUserID" class="form-control form-control-index" placeholder="用戶名" type="text" runat="server" tabindex="1" />
</div>
<div class="form-group ">
    <input type="password" style="display: none">
    <input id="txtUserPwd" class="form-control form-control-index" type="text" onfocus="this.type='password'" placeholder="密碼" autocomplete="off" runat="server" tabindex="2" />
</div>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章