如何关闭iOS中HTML表单字段的自动大写?

Pau*_*ite 135 html html5 ios

默认情况下,iOS的键盘将文本表单字段(包括type=email)中的第一个字母设置为大写.(至少在iOS 5之前)

有没有办法禁用自动资金化?

thi*_*dot 287

从iOS 5开始,type="email"自动禁用自动大写功能,因此您只需:

<input type="email">
Run Code Online (Sandbox Code Playgroud)

对于其他输入类型,可以使用他们所说的属性:

<input type="text" autocorrect="off" autocapitalize="none">
Run Code Online (Sandbox Code Playgroud)

如果由于某种原因您希望在版本5之前支持iOS,请将其用于type="email":

<input type="email" autocorrect="off" autocapitalize="none">
Run Code Online (Sandbox Code Playgroud)

更多信息:

  • 使用`autocapitalize ="none"`而不是`autocapitalize ="off"`因为``off``被弃用为`autocapitalize`.参见[官方文档](https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/Attributes.html#//apple_ref/doc/uid/TP40008058-autocapitalize). (24认同)
  • 我觉得现在有点过时了.当我在iOS 5上输入="email"时,将禁用autocapitalize. (6认同)
  • Android还支持`autocapitalize`:http://stackoverflow.com/a/32616808/9636 (2认同)

Hol*_*y E 5

提醒您,如果您正在查看此示例,并且正在使用React Native,则需要将这些道具用作驼峰式。

autoCapitalize

autoCorrect

这让我有些困惑,直到我查看了用于文本输入React Native文档