"...Remember being a youngster, mom or dad telling you "close the door"? Well the same applies to HTML ...."


HTML   Advanced HTML For Beginners > HTML > HTML Forms

 Register

 
  • Learn the 7 input types of HTML forms
  • Complete HTML forms tags list
  • Input Type Checkbox

This input type creates a checkbox that can either be checked or unchecked by the user. You specify what the boxes will send you if checked. These can all be checked at the same time.
Here is an example.

Check your favorite teams! (check all that apply):
<input type="checkbox" name="team" value="team" checked>Spurs<br>
<input type="checkbox" name="team" value="pacers">Pacers<br>
<input type="checkbox" name="team" value="kings" checked>Kings<br>
<input type="checkbox" name="team" value="other">Other

The code above would result in this (but only if with in <form>tags):

Check your favorite teams! (check all that apply):
Spurs
Pacers
Kings
Other

Here are the attributes to this input type

  • input * - tells the browser that this is part of the form

  • type * - tells the browser what input type it is

  • name * - when the form is submitted, this is the header the information in this field will go under

  • value * - this is what it the browser sends if that box is checked (can be anything)

  • checked - if this is included in the tag, when the page loads up it will already be checked

* = mandatory

This input type is definitely a little harder, but it's still very useful. (it looks good if used with a definition list.)

Back to the HTML Forms Tutorials menu.

Web Hosting
Shared       
Reseller     
VPS             
Dedicated 
Price:   $(US)
Space:     (MB)
Transfer:(GB)
Platform:


HTML Forum

HTML Tools