Adding HTML5 Spellcheck to the HTML5 Form
The W3C's HTML5 specification added HTML5 spellcheck attribute to input and textarea elements of the HTML5 web page. In fact, textarea element has HTML5 spellcheck enabled automatically. However, you can remove textarea spellcheck by setting attribute of the textarea element to false.
The HTML5 spellcheck is a part of any contenteditable HTML5 element on the form. It can be enabled and disabled as shown in the example below:
<input type="text" spellcheck="true" />
Complete example of HTML5 spellcheck in HTML5 markup language is provided below.
<html>
<head>
<title>HTML5 spellcheck example</title>
</head>
<body>
<!—HTML5 Spellcheck Comment -->
<label>HTML5 spellcheck input form:
<input type="text" autofocus spellcheck="true" />
<textarea spellcheck="true">Text area element </textarea>
</label>
</body>
</html>
The HTML5 spellcheck gas three different attributes as explained in the table below:
Keyword |
Description |
Comments |
true |
True is applied to the input, textarea of another editable field |
IE 9, FireFox and Chrome |
false |
False is applied to the input, textarea of another editable field |
IE 9, FireFox and Chrome |
none |
If spellcheck is not set, than form element inherits it from the parent |
IE 9, FireFox and Chrome |