A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-spell-check/ below:

HTML Spell Check - GeeksforGeeks

HTML Spell Check

Last Updated : 29 Aug, 2024

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 that 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: 

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: 



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4