HTML and CSS Reference
In-Depth Information
Using the checkbox input type
In some cases when capturing information from users, you need to be able to capture more
than one choice as it relates to a specific question. In this case, the checkbox input control
is the best choice. You can provide a series of check boxes and allow users to select all that
apply.
The survey will now add a question where users can select multiple items, as follows:
<tr>
<td>Your age in years:</td>
<td><input type="number" /></td>
</tr>
<tr>
<td>
What colors have you colored your hair:
</td>
<td>
<input type="checkbox" id="chkBrown"/> Brown
<input type="checkbox" id="chkBlonde"/> Blonde
<input type="checkbox" id="chkBlack"/> Black
<input type="checkbox" id="chkRed"/> Red
<input type="checkbox" id="chkNone"/> None
</td>
</tr>
In this HTML example, users see a list of hair colors that they might have used. Because a
user possibly might have used more than one, she has the option to choose more than one.
Figure 3-8 shows the output of this HTML.
FIGURE 3-8 The input check box added to the HTML form
 
Search WWH ::




Custom Search