DEV Community

Cover image for How to check for spelling mistakes or errors in input tag natively in HTML?
MELVIN GEORGE
MELVIN GEORGE

Posted on • Originally published at melvingeorge.me

How to check for spelling mistakes or errors in input tag natively in HTML?

Originally posted here!

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" />
Enter fullscreen mode Exit fullscreen mode
  • 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 either true or false.

See the above code live in JSBin

Feel free to share if you found this useful 😃.


Top comments (0)