Computer >> Computer tutorials >  >> Programming >> Javascript

How to specify whether the element is to have its spelling and grammar checked or not in HTML?


To specify whether the element is to have its spelling and grammar checked, use the spellcheck attribute in HTML. The attribute checks spelling and grammar for text in input elements, <textarea> elements, and editable elements.

Note − It works for input elements, but not a 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>