1. 程式人生 > >關於input標籤的記住密碼

關於input標籤的記住密碼

        今天同事問了我一個這樣的問題:

            

        查詢了一些網上的資料,進行整合,以防之後會用到,也給大家提供一個參考。

        方法1:

            input標籤有一個屬性autocomplete屬性

            該屬性預設為‘on’,所以將該屬性設定為‘off’即可禁用自動完成功能。即為:

                <input type="text" autocomplete="off" />

        方法2:

                如果在fom標籤內,input沒有type=‘password’標籤的話,方法1即可。

                若有,則可以設定autocomplete屬性為其他值,‘new-password

        方法3:

                在使用者名稱和密碼標籤之間新增一個隱藏的input type=‘password’的標籤,如:

                    <input type="text">

                    <input type="password" style="display:none">

                    <input type="password">