HTML global attributeGlobal attributes
spellcheck
Turns spell checking on or off in editable text.
- Applies to
- Editable elements: text fields and elements with
contenteditable
Example
#HTML
<textarea spellcheck="true" rows="2">This sentense has a spelling mistake</textarea>
<textarea spellcheck="false" rows="2">const usrNme = "jake_dev"</textarea>Preview
Definition and usage
#The spellcheck attribute tells the browser whether to underline spelling mistakes in text fields and in elements with contenteditable.
Turning it off is useful in fields where the dictionary only gets in the way: usernames, codes, addresses, code snippets. In ordinary fields for longer text it is worth leaving it on.
It is only a hint. The final decision is made by the browser and the system settings, and the check uses the dictionary of the language set by the lang attribute.
Syntax
#Syntax
<element spellcheck="true | false">…</element>Values
#true
Check spelling.false
Do not check spelling.
Browser support
#Widely available
Works in all modern browsers, phones included. You can use it without worry.
- Chrome
- Edge
- Firefox
- Safari
Good practices
#- In fields for code and identifiers, combine
spellcheck="false"withautocomplete="off"andautocapitalize="off". - Set a correct
lang, otherwise the browser may underline correct words.
Related entries
#- contenteditableLets the user edit the element’s content directly on the page.
- <textarea>A multi-line text field for longer input: messages, reviews, descriptions.
- <input>A form field: text, email, password, number, date, slider, checkbox, file and many more.
- langThe language of the element’s content, for example pl or en.
- autocapitalizeTells the on-screen keyboard when to capitalize: never, at the start of a sentence, at the start of a word, or always.
Spotted a mistake or missing an example? Write to us.