拼写检查_拼写检查属性

拼写检查

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开发人员提供了许多有用的属性: downloadplaceholderautofocus等。 较有用的较早属性是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!

您可以对INPUTTEXTAREAcontenteditable元素使用拼写检查。 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属性可以使我们免于尴尬!

翻译自: https://davidwalsh.name/spellcheck

拼写检查

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值