Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. HTMLElement
  4. spellcheck

HTMLElement: spellcheck property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Thespellcheck property of theHTMLElement interface represents a boolean value that controls thespell-checking hint. It is available on all HTML elements, though it doesn't affect all of them.

It reflects the value of thespellcheck HTML global attribute.

Value

A boolean value that istrue if the spelling and grammar of the text content in the element may be checked,false otherwise.

Examples

The following example shows how to control thespell-checking hint via script:

html
<div>  <span>The spelling and grammar may be checked: </span>  <span contenteditable="true" spellcheck="true">test</span></div><input type="checkbox" checked />Enable spelling and grammarcheck
js
const label = document.getElementById("sc-label");const element = document.getElementById("sc-element");const controller = document.getElementById("sc-controller");controller.addEventListener("change", (e) => {  if (controller.checked) {    element.spellcheck = true;    label.innerText = "The spelling and grammar may be checked: ";  } else {    element.spellcheck = false;    label.innerText = "The spelling and grammar may not be checked: ";  }});

Note that you must enable the browser setting to check spelling and grammar.

Specifications

Specification
HTML
# dom-spellcheck-dev

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp