拼写检查
Many useful attributes have been provided to web developers recently: download, placeholder, autofocus, and more. One helpful older attribute is the spellcheck attribute which allows developers to control an elements ability to be spell checked or subject to grammar checks. Simple enough, right? Let's take a look at how it's used!
最近,已经为Web开发人员提供了许多有用的属性: download , placeholder , autofocus等。 较有用的较早属性是spellcheck属性,该属性使开发人员可以控制元素的能力以进行拼写检查或语法检查。 很简单,对不对? 让我们看看它的用法!
HTML (The HTML)
The spellcheck
attribute uses values of true or false (you cannot simply add the spellcheck attribute to a given element):
spellcheck
属性使用true或false值(您不能简单地将spellcheck属性添加到给定的元素):
<!-- spellcheck everything! -->
<input type="text" spellcheck="true" /><br />
<textarea spellcheck="true"></textarea>
<div contenteditable="true" spellcheck="true">I am some content</div>
<!-- spellcheck nothing! -->
<input type="text" spellcheck="false" /><br />
<textarea spellcheck="false"></textarea>
<div contenteditable="true" spellcheck="false">I am some content</div>
You can use spellcheck on INPUT
, TEXTAREA
, and contenteditable
elements. The spellcheck
attribute works well paired with the autocomplete, autocapitalize, and autocorrect attributes too!
您可以对INPUT
, TEXTAREA
和contenteditable
元素使用拼写检查。 spellcheck
属性与autocomplete,autocapitalize和autocorrect属性搭配使用也很好!
We've all filled out form fields on our mobile and desktop devices which check spelling or grammer and probably shouldn't. The spellcheck attribute can save us from that embarrassment when used properly!
我们已经在移动和台式设备上填写了表单字段,这些字段检查拼写或语法,但可能不应该这样做。 如果使用得当,spellcheck属性可以使我们免于尴尬!
拼写检查