How to add a spellchecker for text in HTML?


To add a spellchecker, use the spellcheck attribute in HTML. The attribute checks spelling and grammer for text in input elements, <textarea> elements and editable elements.

Adding spellcheck

Write spellcheck="true" inside the text type tag.

<input type="text" name="sub" spellcheck="true">    

Note − It works for input elements, but not password.

Example

You can try to run the following code to add spell checker in HTML −

<!DOCTYPE html>
<html>
   <body>
      Subject: <input type="text" name="sub" spellcheck="true">
      <p>Add an incorrect spelling for a word above and see what happens.</p>
      <p contenteditable="true" spellcheck="true">This is an editable conttent, with a spelling mistake. Click to edit.</p>
   </body>
</html>

Updated on: 10-Nov-2023

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements