如何禁用输入类型=文本的拼写检查?

问题描述 投票:14回答:5

我想在我的文本字段<input type="text">上禁用拼写检查,以免出现任何难看的红色弯曲。

我知道其他人也问过同样的问题,但是他们总是做出将spellcheck=false接受的答案。那是不对的。这仅适用于文本区域,不适用于输入。

我希望它至少可以在chrome中使用。

html css input textarea spell-checking
5个回答
14
投票

来自http://blog.whatwg.org/the-road-to-html-5-spellchecking#compatibility

Google Chrome对<textarea>元素但不包括<input type=text>元素]提供按需输入的拼写检查>。它会完全忽略spellcheck属性。它不向最终用户提供更改默认行为或手动检查各个字段的选项。

所以,它到这里结束。


更新

:自Chrome 13(于此答案发布3个月后,于2011年8月发布)以来,<input>元素也支持它。

10
投票

2020年1月更新


1
投票

您可以在spellcheck=false中使用spellcheck="false"<input type="text">。这是对发布的其他答案的略微更新。


0
投票

我确定BalusC的回答当时是正确的,但我认为它已经过时了。我现在正在Win7的Chrome 31.0.1650.57中对此进行测试,并且spellcheck="false"肯定会抑制<input type="text">中令人恐惧的红色弯曲。


0
投票
<table spellcheck="false"> ....
     <td><textarea> blabla </textarea></td> ....
     ....... <td><textarea> xxxxx </textarea></td>
</table>
© www.soinside.com 2019 - 2024. All rights reserved.