I have contenteditable div with text on it. In firefox, there is some kind of grammar correction which underlines the text with red marking. How can I turn it off?
Try --
<textarea spellcheck="false"></textarea>
Since the above is a Firefox-only attribute, if you're concerned about validation, you can also use jQuery to set the attribute, e.g.
$('.textarea_you_want_to_target').attr('spellcheck', false);
Update
It seems in Firefox you have to set spellcheck="false"
on <body>
. See http://jsfiddle.net/26JkW/5/
There is no grammar-checking native to Firefox. Given that every word is being marked as incorrect, it is possible that you have the wrong language selected.
To verify that you have the correct language selected for Firefox's dictionary: When typing in an editable field, right-click the input area. From the context menu, there is an option Languages. Ensure the expected language is selected.
EDIT stealthyninja's answer below contains the method for disabling spell checking as the OP requested. This answer should not be taken as the solution.
According to MDN:
Starting in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6), the spell checker uses the
<input>
element's lang attribute to determine the default spell checker language. If<input>
doesn't have a lang attribute, that attribute is searched each successive parent element and upward toward the root node until one is found.
So to disable spellcheck, not only do I add spellcheck="false"
, but I also add a lang
tag with a dictionary not found on the users computer.
<div contentEditable="true" lang="klingon" spellcheck="false"></div>
This should work on most systems outside of Kronos.