html spellcheck attribute
The spellcheck attribute on the html element:
- → indicates that the content's spelling is to be checked
- is a global attribute → can be applied on all html elements;
- when applied on the root element <html>, its value is inherited by all other html elements
Important Note: when spellcheck attribute is applied on an element, ONLY the editable content of that element is checked for spelling. If the content of that element is not editable, it won't be check for spelling mistakes unless it becomes editable, and you can make it editable by adding the contentEditable attribute on that element.
Examples
<html | attribute | = | "value(s)" | > | ... | <⁄html> | example |
---|---|---|---|---|---|---|---|
17. | spellcheck | = | "", , true, false | <spellcheck=""> ... <⁄ > <spellcheck="true"> ... <⁄ > <spellcheck="false"> ... <⁄ > <spellcheck> ... <⁄ > |
Video demonstration html spellcheck attribute
HTML5 html spellcheck attribute Tutorial
min | video details |
---|---|
00:02 | launch file spellcheck.php in browser |
00:05 | open file spellcheck.php in Notepad++ |
00:13 | the values of the spellcheck attribute: empty string, true, false |
00:17 | a) spellcheck attribute, value: empty string, applied on html starting tag |
00:23 | saving the modifications in Notepad++ and refreshing the file in browser |
00:26 | testing: <html spellcheck=""> |
00:29 | result: the content is checked for spelling and grammar mistakes |
00:39 | NOTE: the rest of the content is not checked for spelling because the content is NOT EDITABLE ! |
00:47 | making the page's content EDITABLE by adding the contentEditable attribute on the html root element |
01:08 | b) spellcheck attribute, value: true, applied on html starting tag |
01:13 | saving the modifications in Notepad++ and refreshing the file in browser |
01:17 | testing: <html spellcheck="true"> |
01:18 | result: the content is checked for spelling and grammar mistakes |
01:26 | c) spellcheck attribute, value: false, applied on html starting tag |
01:32 | saving the modifications in Notepad++ and refreshing the file in browser |
01:36 | testing: <html spellcheck="false"> |
01:37 | result: the content is NO LONGER checked for spelling and grammar mistakes |