2011-06-15 64 views
63

我正在寫一個登錄頁面的Web應用程序我的移動版本,我有一個簡單的HTML密碼字段,像這樣:iPhone瀏覽器默認爲大寫的密碼字段的第一個字母

<input id="password" type="password" /> 

唯一的問題是iPhone Safari瀏覽器默認使用輸入的第一個字母,這使我的用戶感到困惑,因爲密碼區分大小寫,並且他們並不總是意識到這種情況。

有沒有人知道方法,標籤或其他方式來阻止這種情況發生,並強制iPhone輸入爲小寫,除非用戶另有指定?或者,這只是平臺的一個功能,無法更改?

+1

安全文本始終是不區分大小寫,用戶名,你可以把驗證在iphone字大寫。 – Ballu 2011-06-15 10:15:27

回答

151
<input type="text" name="test1" autocapitalize="none"/> 

的文檔可以在這裏找到:Supported Attributes: autocapitalize

+0

完美!謝謝! – Xyon 2013-06-03 09:05:26

+2

很好的答案。正如Ballu提到的,雖然這對輸入類型=密碼是不必要的。 – IAmNaN 2015-04-09 18:01:50

+2

「off」在iOS 5.0中折舊,您應該使用「none」。 這可以防止自動註冊,但是shift鍵在默認情況下仍然是活動的,這是一種痛苦。 – Patrick 2015-11-16 12:36:09

52

您可能要關閉自動更正都和autocapitalize密碼和電子郵件字段。

下面列舉一下我的樣子:

<input autocapitalize="off" autocorrect="off" id="email" name="email" type="text"> 
<input autocapitalize="off" autocorrect="off" id="password" name="password" type="password"> 
+0

爲什麼感謝你,我想要關閉兩者。優秀的建議! – rthbound 2015-11-10 16:36:55

+0

我也使用autocomplete =「off」和spellcheck =「false」,以獲得較好的效果。 – 2017-09-10 18:35:30

相關問題