英文:
How to turn off spellcheck for every control in the whole website?
问题
现在,我关闭了网站上HTML控件的拼写检查,使用spellcheck="false"
。而不是为每个控件逐个设置属性,我如何使其在整个网站的所有控件上都起作用?
一个显示拼写检查错误的控件示例:
英文:
Right now, I turn off the spellcheck for HTML controls in the website with spellcheck="false"
. Instead of setting the attribute one at a time for every control, how can I make it work for all controls in the entire website?
An example of a control where the spell check error is shown:
答案1
得分: 1
> spellcheck 全局属性是一个枚举属性,用于定义元素是否可以检查拼写错误。
作为全局属性,它可以设置在任何元素上。虽然并非所有全局属性对所有元素都产生影响,但为任何元素设置 spellcheck="false"
似乎会禁用其所有后代元素的拼写检查。
因此,您可以将其放在这里的 body
上,并且应该在您的所有内容中关闭它(除非在DOM树的下方明确指定其他情况)。
英文:
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck:
> The spellcheck global attribute is an enumerated attribute that defines whether the element may be checked for spelling errors.
As a global attribute, it can be set on any element. Although not all global attributes have an effect on all elements, setting spellcheck="false"
for any element, appears to disable it for all descendants as well.
So you can put it on body
here, and should have it off for all your content (unless explicitly specified otherwise further down the DOM tree.)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论