HTML Checkbox


 
 
 

  HTML Tutorial > HTML Form > Checkbox

Another type of input is the check box. Check boxes are used when you want users to be able to select more than one of the options. Below is an example:

Code:
<input type="checkbox" name="color" value="red">Red<br>
<input type="checkbox" name="color" value="green">Green<br>
<input type="checkbox" name="color" value="blue">Blue<br>

Red
Green
Blue

In this case, the key is color, and the values can be either red, green, or blue, depending on the check box(es) selected. If multiple check boxes are checked, the "color" key will then have multiple values.

If we want to pre-select a check box, we'll specify "checked" at the end of the <input> tag, such as follows:

<input type="checkbox" name="color" value="red" checked>Red<br>

Buy and sell links for your website at Text Link Ads

Next: Drop Down Menu

Site Map   |   Resources

Link to this page: If you find this page useful, we encourage you to link to this page. Simply copy and paste the code below to your website, blog, or profile.





    Copyright 2006, 2007, 2008 1keydata.com     Privacy Policy