If you find this helpful, please click the Google Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.) |
The spellcheck
attribute in HTML
The spellcheck
property determines whether or not an HTML element will be spell checked. Try entering some text with spelling errors in the following input fields.
This is a contenteditable paragraph. It should be checked for mispelled words.
This is a contenteditable paragraph. It should not be checked for mispelled words.
WebKit browsers such as Chrome and Safari will not highlight (with a dotted red underline) the misspelled words in the existing content, such as "mispelled" in the examples above. If you type in those fields, any spelling errors in new text that is entered in fields created by HTML elements with the spellcheck property set to true will be spell checked, but the text decoration of pre-existing content will not be changed.
How to code the spellcheck
attribute
Make sure you understand the difference between an attribute and property and are familiar with the definitions of other HTML terms.
The spellcheck attribute is an enumerated attribute, not a boolean attribute. There are four possible ways to code the spellcheck
attribute to set the spellcheck property of an element:
- omit the
spellcheck
attribute, in which case the value of the spellcheck property will be inherited spellcheck=""
, which sets the spellcheck property to truespellcheck="true"
, which sets the spellcheck property to truespellcheck="false"
, which sets the spellcheck property to false
All other values are not valid.