--- title: HTMLElement.forceSpellCheck() slug: Web/API/HTMLElement/forceSpellCheck translation_of: Web/API/HTMLElement/forceSpellCheck ---

{{ APIRef("HTML DOM") }}{{SeeCompatTable}}

强制对HTML元素进行拼写和语法检查,即使用户没有关注元素。此方法将覆盖浏览器的行为。检查的界面,例如是否出现红色下划线,由浏览器确定。

Syntax

element.forceSpellCheck()

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', 'interaction.html#dom-forcespellcheck', 'HTMLElement.forceSpellCheck()')}} {{Spec2('HTML WHATWG')}} Initial definition
{{SpecName('HTML5.1', 'editing.html#dom-forcespellcheck', 'HTMLElement.forceSpellCheck')}} {{Spec2('HTML5.1')}} First W3C snapshot of {{SpecName('HTML WHATWG')}} with the method defined in it.

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatUnknown}} {{CompatNo}} {{CompatNo}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatNo}} {{CompatNo}} {{CompatUnknown}} {{CompatUnknown}}

See Also