- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to specify whether the element is to have its spelling and grammar checked or not in HTML?
Grammar and spelling errors in text fields can be found using the HTML spell check tool.
Using the spellcheck property, the spell check capability may be added to HTML forms. The spellcheck attribute is an enumerated attribute that specifies whether or not the HTML element will be checked for mistakes. It is compatible with HTML's "input" and "textarea" fields.
Syntax
Following are the syntax for including spell check in HTML −
<! -- For input field -->. <input type="text" spellcheck="value"> <! -- For input text area -->. <textarea type="text" spellcheck="value"></textarea>
Following are the examples…
Example: Spellcheck value =”true”
In the following example we triggered the spellcheck attribute to “true” to enable spellcheck in an html.
<!DOCTYPE html> <html> <body> <form> <p>Name:<input type="text" spellcheck="true"></p> <p>Address:<textarea spellcheck="true"></textarea></p> <button type="reset">Reset</button> </form> </body> </html>
Output
On executing the script, the output window pops up, consisting of an input area where the user can enter details. If there was any spelling mistake, the area will get underlined with a red line as we set the spellcheck="true."
Example: Spellcheck value=”false”
In the following example we triggered the spellcheck attribute to “false” to disable spellcheck in an html.
<!DOCTYPE html> <html> <body> <form> <p>Name:<input type="text" spellcheck="false"></p> <p>Address:<textarea spellcheck="false"></textarea></p> <button type="reset">Reset</button> </form> </body> </html>
Output
When the script is executed, it checks for the spellcheck value, which is, as previously stated, spellcheck="false." There is no way for the user to check whether he entered correct spelling.
- Related Articles
- How to specify whether the or the element should have autocomplete enabled in HTML?
- How to specify whether the content of an element should be translated or not in HTML?
- How to set whether an element is draggable or not in HTML?
- How to specify that an element is not yet relevant in HTML?
- How to specify that the element is read-only in HTML?
- Check whether the content of an element is editable or not in HTML
- Specify whether the flex items should wrap or not with CSS
- How to set whether or not an element is resizable by the user with JavaScript?
- How to specify which form element a calculation is bound to with HTML?
- How to check whether a checkbox is checked in JavaScript?
- How to specify the language of the element's content in HTML?
- How to specify a unique id for an element in HTML?
- How to check in R whether a matrix element is present in another matrix or not?
- How to check whether a checkbox is checked with JavaScript?
- How to specify citation in HTML?
