Cover Image for HTML 5 Spellcheck attribute
78 views

HTML 5 Spellcheck attribute

The spellcheck attribute in HTML5 is used to control the spell-checking behavior of an input field or a content-editable element. It is an optional attribute that can be applied to the <input>, <textarea>, and <div> (with contenteditable attribute) elements.

The spellcheck attribute can have the following values:

  • spellcheck="true": Enables spell checking on the element. The browser’s built-in spell-checking feature will be activated, and misspelled words will be highlighted.
  • spellcheck="false": Disables spell checking on the element. No spell checking will be performed.
  • spellcheck="default": The browser’s default behavior for spell checking will be applied. It usually depends on the user’s browser settings.

Here’s an example of using the spellcheck attribute:

HTML<span role="button" tabindex="0" data-code="<input type="text" spellcheck="true"> <textarea spellcheck="false"></textarea> <div contenteditable="true" spellcheck="default">
<input type="text" spellcheck="true">
<textarea spellcheck="false"></textarea>
<div contenteditable="true" spellcheck="default"></div>

In the example above, the <input> element enables spell checking, the <textarea> element disables spell checking, and the <div> element with contenteditable="true" uses the browser’s default spell-checking behavior.

Please note that the actual spell-checking behavior may vary depending on the user’s browser and settings.

YOU MAY ALSO LIKE...

The Tech Thunder

The Tech Thunder

The Tech Thunder


COMMENTS