HTML and CSS Reference
In-Depth Information
Figure 5-18. Displaying a placeholder
Enabling Spell-Check
If your form accepts free-form text input from the user, you may want to enable spell-check on the
content. Suppose, for example, that you're developing a blog engine that allows users to post and edit
articles. It would be nice to enable spell-check for the content. This way, users can trap spelling errors
easily. The spellcheck attribute does this job for you. Here is how you use it:
<textarea id="textarea1" rows="5" cols="50" spellcheck="true"></textarea>
The spellcheck attribute is a Boolean and can be set to true or false . If it's set to true , the <textarea>
(or <input> ) highlights spelling errors as shown in Figure 5-19.
Figure 5-19. Enabling spell-check for a <textarea>
Notice how an incorrect spelling is highlighted with a red underline.
Turning Off Autocomplete
Most browsers try to help users fill data-entry forms with the help of the autocomplete feature. This feature
lets users pick a value from a list instead of typing the entire value. At times, however, you may want to
disable this feature for an input field. The autocomplete attribute allows you to do just that. The following
markup shows how it's used:
<input id="irstName" type="text" autocomplete="off"/>
Of course, you can set autocomplete to on to explicitly turn on the feature. You can also turn
autocomplete on or off for the entire form by adding the autocomplete attribute to the <form> tag instead of
the individual <input> tag:
Search WWH ::

Custom Search