Firefox 2 introduces spell checking support to text areas and text fields in web forms. The user can specify using the about:config interface whether or not spellchecking is enabled and whether to check both text areas and text fields or only text areas.
By default, text areas get spell checked while text fields do not.
However, there may be situations in which this behavior is not necessarily appropriate. For instance, if a text area is intended to be used for editing HTML or other non-prose data, the spell checker would be a hindrance rather than a help. Similarly, there may be cases in which a web site would like to recommend to Firefox that spell checking be enabled for a specific text field.
If a web site wishes to recommend whether or not to use spell checking for a specific
<input> element, it can use the
spellcheck attribute, specifying a value of
true to recommend enabling spell checking or
false to recommend against using it.
Keep in mind that the site's recommendation may be ignored if the user has disabled spell checking entirely by setting
layout.spellcheckDefault to 0. If
layout.spellcheckDefault has any other value, the recommendations are taken into account.
You can code a text field to enable spell checking with HTML like this:
<input type="text" size="50" spellcheck="true">
You can apply the
spellcheck attribute to other elements as well, such as
<div> elements, in which case any contained
<input> elements inherit that setting;
<input> elements that do not have a
spellcheck attribute inherit the spell check setting specified by their parent. If there is no setting specified in any ancestor elements, the user's default setting is used.
<div spellcheck="true"> <label>Type a sentence: </label><input type="text" size="50"> <br /> <label>Type another: </label><input type="text" size="50"> </div> <br /> <label>Type a third: </label><input type="text" size="50">
In this HTML snippet, the first two text fields are spell checked while the third is not.