HTML | Spell Check
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.
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.
- Eaxmple:1
<!DOCTYPE html><html><body><h3>Example of Enabling SpellCheck</h3><form><p><inputtype="text"spellcheck="true"></p><p><textareaspellcheck="true"></textarea></p><buttontype="reset">Reset</button></form></body></html>chevron_rightfilter_none - 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.
- Eaxmple:2
<!DOCTYPE html><html><body><h3>Example of Disabling SpellCheck</h3><form><p><inputtype="text"spellcheck="false"></p><p><textareaspellcheck="false"></textarea></p><buttontype="reset">Reset</button></form></body></html>chevron_rightfilter_none - Output:

Supported Browsers: The browser supported by spellcheck attribute are listed bellow:
- Google Chrome 9.0
- Internet Explorere 11.0
- Firefox
- Opera
- Safari
Recommended Posts:
- How to check an HTML element is empty using jQuery ?
- HTML Course | Structure of an HTML Document
- HTML Course | Basics of HTML
- HTML | DOM HTML Object
- PHP | Palindrome Check
- How to check the existence of URL in PHP?
- How to check if URL contain certain string using PHP?
- PHP | check if a number is Even or Odd
- PHP to check substring in a string
- PHP | Check if a number is prime
- PHP | ctype_alnum() (Check for Alphanumeric)
- How to check whether an object is a date?
- How to check an array is multidimensional or not in PHP ?
- How to check form submission in PHP ?
- PHP | Check if a variable is a function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



