我们的志愿者还没有将这篇文章翻译为 中文 (简体)。加入我们帮助完成翻译!
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.
The spellcheck global attribute is an enumerated attribute defines whether the element may be checked for spelling errors. It may have the following values:
true
, which indicates that the element should be, if possible, checked for spelling errors;false
, which indicates that the element should not be checked for spelling errors.
If this attribute is not set, its default value is element-type and browser-defined. This default value may also be inherited, which means that the element content will be checked for spelling errors only if its nearest ancestor has a spellcheck state of true
.
You can consult this article to see a comprehensive example of the use of this attribute.
This attribute is an enumerated one and not a Boolean one. This means that the explicit usage of one of the values true
or false
is mandatory and that a shorthand like <label spellcheck>Example Label</label>
is not allowed. The correct usage is <label spellcheck="true">Example Label</label>
.
This attribute is merely a hint for the browser: browsers are not required to be able to check for spelling errors. Typically non-editable elements are not checked for spelling errors, even if the spellcheck attribute is set to true and the browser supports spellchecking.
The default value of this attribute is browser and element-dependant:
Browser | <html> |
<textarea> |
<input> |
others | Comment |
---|---|---|---|---|---|
Firefox | false |
false |
false |
inherited | When layout.spellcheckDefault is 0 |
false |
true |
inherited | inherited | When layout.spellcheckDefault is 1 (default value) |
|
false |
true |
true |
inherited | When layout.spellcheckDefault is 2 |
|
Seamonkey | false |
false |
false |
inherited | When layout.spellcheckDefault is 0 |
false |
true |
inherited | inherited | When layout.spellcheckDefault is 1 (default value) |
|
false |
true |
true |
inherited | When layout.spellcheckDefault is 2 |
|
Camino | false |
false |
false |
inherited | When layout.spellcheckDefault is 0 |
false |
true |
inherited | inherited | When layout.spellcheckDefault is 1 |
|
false |
true |
true |
inherited | When layout.spellcheckDefault is 2 (default value) |
|
Chrome | false |
true |
? | inherited | |
Internet Explorer | false |
true |
? | inherited | |
Opera | false |
true |
? | inherited | |
Safari | false |
true |
? | inherited |
Specifications
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'spellcheck' in that specification. |
Living Standard | No change from latest snapshot, HTML5.1 |
HTML5.1 The definition of 'spellcheck' in that specification. |
Working Draft | Snapshot of WHATWG HTML Living Standard, initial definition |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | 2.0 (1.8.1) | (Yes) | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | Not supported | ? | 1.0 (1.8.1) | ? | ? | ? |
See also
- All global attributes.