[spellcheck]

Term side of the Card.
Topic: Global Attributes
Unit title: [spellcheck]
Categories: Attribute
Explanation side of the Card

Explanation: The attribute that enables or disables spell checking for editable content, such as `<input>`, `<textarea>` or `contenteditable` elements. When enabled, the browser underlines misspelled words.

Browser compatibility:
  • The chrome browser supports this feature starting from version 9.
  • The edge browser supports this feature starting from version 12.
  • The firefox browser supports this feature starting from version 2.
  • The safari browser supports this feature starting from version 5.1.
Availability: 

Example

Wronghtml
<label for="key">API key</label>
<input id="key" name="api_key" spellcheck="off">
Righthtml
<label for="key">API key</label>
<input id="key" name="api_key" spellcheck="false">

spellcheck takes 'true' or 'false', so 'false' turns the red underlines off.

Common mistakes

  • Writing spellcheck='off', which is not a valid value.
  • Leaving red underlines on code editors and token fields.

Key points

  • Fields for codes, emails, usernames and passwords set spellcheck='false'.
  • Values are 'true' or 'false', not 'on' or 'off'.
  • Long free-text fields like comments keep spell check on.

Interview questions

Is spellcheck a boolean attribute?

No. It is enumerated, so spellcheck='false' turns it off. An empty value means 'true'.

Is spellcheck the same as autocorrect?

No. Spell check only marks words. Autocorrect changes them as the user types.

Does spellcheck work on contenteditable elements?

Yes. It applies to editable text, including <textarea>, text inputs and contenteditable regions.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy