HTML5拼写检查 - 确定是否找到任何拼写错误的单词的任何方法

Han*_*Dan 6 html5 spell-checking angularjs

我想使用HTML5拼写检查属性来检查输入拼写错误.如果用户尝试使用拼写错误提交,则使用angularJS会显示警告.有没有办法访问一些状态,说明是否在文本块中找到了拼写错误.

小智 1

您可以使用这个 JavaScript 插件: https: //www.javascriptspellcheck.com/

要使用它,您只需解压它并引用它。它还在其网站上提供了“Hello World”教程和详细记录的方法。

提供的工作示例代码如下:

<script type='text/javascript' src='/JavaScriptSpellCheck/include.js' ></script>
<script type='text/javascript'>$Spelling.SpellCheckAsYouType('myTextArea')</script>
<textarea name="myTextArea"  id="myTextArea" cols="30" rows="4" style = 'max-width:500px;width:100%;height:200px;margin-bottom:20px'>
        This this is a simple exampl of Spell-checking As-You-Type using javascript spellcheck.
        It works in almost any browser, and supports upto 24 international languages.
        The button bellow shows an alternative way to spellcheck using javascript spellcheck - using a dialog iwndow!
</textarea>
<input type="button" value="Spell Check in a Dialog" onclick="$Spelling.SpellCheckInWindow('myTextArea')" />
Run Code Online (Sandbox Code Playgroud)