The HTML spellcheck attribute
The HTML spellcheck attribute hints whether the browser should check the spelling and grammar of an element's editable content. Use spellcheck="true" or "false". It is a global attribute that applies to form fields and contenteditable regions.
Overview
The spellcheck attribute asks the browser to spell- and grammar-check editable text such as <input>, <textarea> and contenteditable elements. It is an enumerated attribute, not a boolean: a bare spellcheck or spellcheck="true" turns checking on, and only spellcheck="false" turns it off.
The result depends on the browser and operating system, and the attribute is only a hint. Turn it off for fields where checking is unhelpful or distracting, such as usernames, email addresses, codes and serial numbers.
Syntax
<textarea spellcheck="true"></textarea>
<input type="text" spellcheck="false">
Values
| Value |
|---|
| true (or empty) | false |
Example
<textarea spellcheck="true" rows="2" style="width:100%; padding:8px;">Tpe a missspelled wrd to see the check.</textarea>
Best practices
- Use inputmode to bring up the right on-screen keyboard (numeric, email, and so on).
- Set autocapitalize appropriately: off for names and codes, sentences for prose.
- These are hints; do not rely on them for validation.
- Test on real mobile devices, where most of these take effect.