The Wayback Machine - https://web.archive.org/web/20240707130911/https://www.geeksforgeeks.org/html-spell-check/
Open In App

HTML Spell Check

Last Updated : 07 Jul, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The Spell Check feature in HTML is used to detect grammatical or spelling mistakes in the text fields.

The Spell Check feature can be applied to HTML forms using the spellcheck attribute. The spellcheck attribute is an enumerated attribute which defines whether the HTML element will be checked for errors or not. It can be used with “input” and “textarea” fields in HTML.

Supported Tags: It supports all HTML elements. 

Syntax : 

Syntax for spellcheck attribute in an input field in html:  

<input type="text" spellcheck="value">

Syntax for spellcheck in a textarea field in html: 

<textarea type="text" spellcheck="value"></textarea>

In the above syntax the value assigned to spellcheck will define whether spellcheck will be enabled or not on the element. The spellcheck attribute has two valid values, which are: 

  • True: It defines that the HTML element should be checked for errors.
  • False: It defines that the HTML element should not be checked for errors.

When the attribute is not set, it takes the default value which is generally element type and browser defined. The value can be also be inherited from the ancestral element.

Enabling Spell Check in an HTML Form: To enable spellcheck in an HTML form the spellcheck attribute is set to “true”. Below is the sample HTML program with enabled spellcheck.  

Example:1

HTML




<!DOCTYPE html>
<html>
 
<body>
    <h3>Example of Enabling SpellCheck</h3>
    <form>
        <p>
            <input type="text" spellcheck="true">
        </p>
         
        <p>
            <textarea spellcheck="true"></textarea>
        </p>
         
        <button type="reset">Reset</button>
    </form>
</body>
 
</html>


Output: 

Disabling Spell Check in a HTML Form: To disable spellcheck in a HTML form the spellcheck attribute is set to “false”. Below is the sample HTML program with disabled spellcheck.  

Example:2

HTML




<!DOCTYPE html>
<html>
 
<body>
    <h3>Example of Disabling SpellCheck</h3>
    <form>
        <p>
            <input type="text" spellcheck="false">
        </p>
 
        <p>
            <textarea spellcheck="false"></textarea>
        </p>
         
        <button type="reset">Reset</button>
    </form>
</body>
 
</html>


Output: 

Supported Browsers: The browser supported by spellcheck attributes are listed below: 

  • Google Chrome 9.0
  • Internet Explorer 11.0
  • Firefox
  • Opera
  • Safari


Previous Article
Next Article

Similar Reads

How to disable spell checking from Input Box and Textarea in HTML forms?
Basically the concept of spell check feature is used when we enter the grammatically incorrect words inside &lt;input&gt; or &lt;textarea&gt; fields in HTML form you will see the red underline below the incorrect words. It is used to detect grammatical or spelling mistakes in the text fields. To disable spellcheck in an HTML form the spellcheck att
1 min read
How to turn off spell checking for HTML form elements ?
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 identi
2 min read
How can you cast a simple spell in Node.js ?
Node.js is a cross-platform, open-source back-end JavaScript runtime environment that uses the V8 engine to execute JavaScript code outside of a web browser. Node.js allows developers to utilize JavaScript to create command-line tools and server-side scripting, which involves running scripts on the server before sending the page to the user's brows
1 min read
How to check an HTML element is empty using jQuery ?
Given an HTML document and select an element from the HTML document and check that element is empty or not. There are two methods used to solve this problem which are discussed below: Method 1: Using the ":empty" selector: The element to be checked using is() method. The is() method is used to check if one of the selected elements matches to the se
3 min read
How to check if a string is html or not using JavaScript?
The task is to validate whether the given string is valid HTML or not using JavaScript. we're going to discuss a few techniques. Approach Get the HTML string into a variable.Create a RegExp which checks for the validation.RegExp should follow the rules of creating an HTML document. Example 1: In this example, a regexp is created and it is validatin
2 min read
How to check for errors in HTML ?
HTML5 is easy to understand and it's not compiled into different forms before the browser displays it. In any code, 2 types of errors are possible: Syntax error: Incorrect syntax leading to compile time error in other languages.HTML have no affect of syntax error.Logical error: Syntax is correct but output is unexpected because of wrong logic. In H
2 min read
Check whether HTML element has scrollbars using JavaScript
Given an HTML document, the task is to identify whether a particular element has scrollbars or not. In this article, we are going to check whether the HTML element has scrollbars using JavaScript. Below are the different approaches to check whether HTML element has scrollbars using JavaScript: Table of Content Using element.scrollWidth and .clientW
3 min read
HTML | DOM HTML Object
The HTML Object property in HTML DOM is used to represent or access the HTML &lt;html&gt; element with in the object. The &lt;html&gt; element is used to return the HTML document as an Element Object. Syntax: It is used to access a &lt;html&gt; element.var x = document.getElementsByTagName("HTML")[0]; It can also be used to access a &lt;html&gt; el
3 min read
HTML | &lt;html&gt; xmlns Attribute
The HTML &lt;html&gt; xmlns Attribute is used to specify the xml namespace for a document. Important Note: This attribute is mainly required in XHTML, not valid in HTML 4.01, and optional in HTML 5. Syntax: &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; Attribute Values: https://www.geeksforgeeks.org/ It defines the namespace to use (for XHTML d
1 min read
Inline HTML Helper - HTML Helpers in ASP.NET MVC
HTML Helpers are methods that returns HTML strings. These are used in the view. In simple terms, these are C# methods that are used to return HTML. Using HTML helpers you can render a text box, an area, image tag, etc. In MVC we have many built-in HTML helpers and we can create custom helpers too. Using HTML helpers a view can show model properties
2 min read
Article Tags :
three90RightbarBannerImg