To automatically check for spelling mistakes while writing text in the input tag in HTML, you can use the spellcheck
global attribute in the input tag and pass value true
to enable the feature and value false
to disable the feature.
For example, let's say you wanted to check for spelling errors in the input tag element, we can do like this,
<!-- Check for spell errors in input tag element -->
<input type="text" spellcheck="true" />
- If the spelling for a word is wrong a red squiggly line will appear below the corresponding word. (May differ from browser to browser)
- You might think the values for
spellcheck
global attribute is of boolean type but it is not, it should be the correct values of eithertrue
orfalse
.
See the above code live in JSBin