How to disable spell checking from Input Box and Textarea in HTML forms
Topic: HTML / CSSPrev|Next
Answer: Set the spellcheck
attribute to false
Usually, when you enter the grammatically incorrect words inside <input>
or <textarea>
fileds in an HTML form you will see the red underline below the incorrect words.
This is the default behavior of Chrome and Firefox. However if you are using the input fields or text areas for editing the code or other non-prose data then the spell checker would not appropriate. In such situations you can disable this spell checking in HTML forms by setting the spellcheck
attribute to false
, like spellcheck="false"
. Let's check out an example:
Example
Try this code »<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Disable Spell Checking</title>
</head>
<body>
<form>
<p>
<input type="text" spellcheck="false">
</p>
<p>
<textarea spellcheck="false"></textarea>
</p>
<button type="reset">Reset</button>
</form>
</body>
</html>
Tip: To disable the spell checking in the entire form at once — just set the spellcheck="false"
in the <form>
tag, like this <form spellcheck="false">
.
Related FAQ
Here are some more FAQ related to this topic: