I'd like to use the HTML5 spellcheck attribute to check for input typos. Using angularJS so would display an alert if the user tries to submit with typos. Is there any way to access some state that says if typos have been found in a text block.
The wrong word Spell check does just that: catches words that are spelled wrong. But if you write the wrong word altogether, spell check won't save you if that word is spelled correctly.
HTML spellcheck AttributeThe spellcheck attribute specifies whether the element is to have its spelling and grammar checked or not. The following can be spellchecked: Text values in input elements (not password) Text in <textarea> elements.
You can use this javaScript plugin: https://www.javascriptspellcheck.com/
To use it you just need to unzip it and reference it. It also has a "Hello World" tutorial and well documented methods at their site.
The provided working example codes like this:
<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')" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With