问题描述
对于正常的输入元素,您可以使用HTML属性拼写检查至少在FF下)。相同的 spellcheck =false
似乎不适用于contentEditable元素。有没有另一种解决方案的ContentEditable元素?
For normal input elements you can turn off the spell checking by using a HTML attribute (at least under FF). The same spellcheck="false"
does not seem to work on a contentEditable element. Is there another solution for contentEditable elements?
推荐答案
我不确定这是你得到的,但我听起来像是从contentEditable元素中删除拼写检查下划线的类似问题。问题是,当您将 spellcheck
属性设置为false时,由于拼写错误而加下划线的所有单词都会保持下划线,直到您将注意力集中在contentEditable元素上。
I'm not sure if this is what you're getting at, but I was having what sounds like a similar problem with removing the spellcheck underline from contentEditable elements. The problem is, when you set the spellcheck
attribute to false, any words that were underlined for spelling mistakes will keep this underline until you focus on the contentEditable element.
以下hack应该做的诀窍:
The following hack should do the trick:
element.spellcheck = false;
element.focus();
element.blur();
希望有帮助!
这篇关于对contentEditable元素的spellcheck = false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!