简体   繁体   English

在 Safari 文本输入中禁用自动更正

[英]Disable autocorrect in Safari text input

I'm using the autocorrect "off", etc. in input boxes on my site.我在我网站的输入框中使用自动更正“关闭”等。 However, Safari on Mac OS X still auto corrects text input.但是,Mac OS X 上的 Safari 仍会自动更正文本输入。

This is what I have:这就是我所拥有的:

 <input autocomplete="off" autocorrect="off" autocapitalize="off" type="text" name="url" placeholder="Enter a web address">

But when I test it on Safari version 9 ( Mac OS X v10.11 (El Capitan)), it is still autocorrecting the text.但是当我在 Safari 版本 9( Mac OS X v10.11 (El Capitan))上测试它时,它仍然在自动更正文本。

Is there a more robust answer?有没有更靠谱的答案? Is the new version of Safari overwriting it?新版Safari会覆盖吗?

You need to add spellcheck="false" to your input.您需要在输入中添加spellcheck="false"

 <input autocomplete="off" autocorrect="off" autocapitalize="off" type="text" name="url" placeholder="Enter a web address" spellcheck="false">

Fiddle小提琴

If you have to do this with jQuery, you'll need to leave the quotes off of false.如果必须使用 jQuery 执行此操作,则需要将引号保留为 false。

$(this).prop("spellcheck", false); // this works

$(this).prop("spellcheck", "false"); // this does NOT properly set the property

Change input type from text to search将输入类型从文本更改为搜索

<input type="search">

Or或者

https://discussions.apple.com/thread/8325873 https://discussions.apple.com/thread/8325873

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM