HTML spellcheck Global Attribute

If this site has been useful, we’d love your support! Running this site takes time and resources, and every small contribution helps us keep creating valuable content. Consider buying us a coffee to keep things going strong!

Description

The spellcheck global attribute is a boolean attribute that specifies whether the element should be checked for spelling errors. It can take the values true or false. If the attribute is not present, its default value is element-type and browser-defined.

The spellcheck global attribute can be used on any HTML element, but it is most commonly used on editable elements, such as <input>, <textarea>, and <contentEditable> elements. When the spellcheck attribute is set to true, the browser will check the spelling of the text in the element as it is being typed. If the browser finds a misspelled word, it will typically underline it with a red line.

The spellcheck global attribute is a hint to the browser, not a requirement. Browsers are not required to check for spelling errors, and they may not do so for all elements. For example, browsers typically do not check for spelling errors in non-editable elements, such as <p> and <div> elements.

Here is an example of how to use the spellcheck global attribute:

<input type="text" spellcheck="true">

This will create a text input field where the browser will check the spelling of the text as it is being typed.

The spellcheck global attribute can be used to improve the accessibility of your web pages. By enabling spell checking, you can help users with disabilities, such as dyslexia, to write error-free text.

Syntax

<element spellcheck="true | false">

Values

  • trueTells the browser to check the spelling and grammar in the text of the element.
  • falseTells the browser that the spelling and grammar in the text of the element should not be checked.

Example

<p contenteditable="true" spellcheck="true">Edit this paragraph. Errors will be displayed.</p> 
<p contenteditable="true" spellcheck="false">Edit this paragraph. Errors will not be displayed.</p>

Browser Support

The following table will show you the current browser support for the HTML spellcheck Global Attribute.

Desktop
Edge Chrome Firefox Opera Safari
YesYesYesYesYes
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
YesYesYesYesYesYes

Last updated by CSSPortal on: 14th October 2023