Open In App

How to turn off spell checking for HTML form elements ?

Last Updated : 04 Oct, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

You may have noticed often that while filling a form in any website if we made any spelling or grammatical mistake it would get underlined by a red wavy line. It is sometimes annoying for the user as he/she may get distracted by it. So, many websites turn off the Spell Check Feature for their users. The Spell Check feature in HTML is used to identify grammatical or spelling mistakes made by the user while giving the input in the form. In this article, we will discuss how to turn off the spell check feature for the HTML form element

Spell Check feature can be enabled/disabled using an attribute called spellcheck which defines whether the HTML element will be checked for the errors or not. It takes two values, either true or false. When you give the value as true, it will be turned on and will check for any grammatical/ spelling errors present in the field, and when the value is given false, it will get turned off and will not check for any errors. The spellcheck attribute supports all the HTML form elements.

Syntax:

<form spellcheck="value (either true or false)"></form>

For Input Field:

<input type="text" spellcheck="value (either true or false)">

 

For Text Area Field:

<textarea type="text" 
    spellcheck="value (either true or false)">
</textarea>

Now let’s see an example of how to turn it off by writing an HTML code for the same.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>Turn off Spell Check Feature</title>
</head>
  
<body>
    <h2>
        Demonstration of how to turn off the 
        spell check for HTML Form Elements
    </h2>
      
    <form>
        <p>Name: <input type="text" spellcheck="true"></p>
          
        <br>
        <p>
            Message: <textarea type="text" 
            spellcheck="false"></textarea>
        </p>
    </form>
</body>
  
</html>


Output: You can notice in both the fields that there is one red wavy line under the words of the first column showing the grammatical errors because spellcheck is true in this field whereas in the text area the spell check is false that’s no red wavy line is not appear under the wrong words.



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads