HTML and CSS Reference
In-Depth Information
N OTE Without sending the modified content to the server, any text changed when in edit mode will
be lost when the page is exited.
spellcheck Attribute
HTML5 defines a spellcheck attribute globally for elements. Interestingly, some browsers
such as Firefox have supported spell checking of form fields and elements in content editing
mode using the contenteditable attribute for some time. HTML5 makes this attribute
Enabling the spell checking of element content is a matter of setting the spellcheck
attribute to true :
<p spellcheck="true"> Spellcheck on: There is a tyyypooo here.
Did the browser spot it? </p>
Testing in supporting browsers shows that indication on content editable regions appears
when there is a spelling error. However, there is unclarity in the specification whether the
user must be in edit mode before the indication should be displayed.
Commonly, this attribute is a bit more useful on form fields, given their interactive nature:
<label> Text field: (spellcheck on)
<input type="text" name="textfield" spellcheck="true" value="There is a
tyyypoo here. Did the browser spot it?"></label>
Given the application of single-line text fields, it is far more useful to set this attribute
on multiline text fields defined by a <textarea> tag, like so:
<label> Text area: (spellcheck on) <textarea name="comments"
spellcheck="true"> There is a tyyypooo here. Did the browser spot it?
N OTE Some browsers may invoke spell checking on elements—particularly the textarea
element—regardless of the presence and value of a spellcheck attribute.
Search WWH ::

Custom Search