HTML/Elements/input/checkbox

From Web Education Community Group
< HTML‎ | Elements‎ | input
Revision as of 14:33, 12 March 2012 by Hiroki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

<input type="checkbox">

The checkbox state represents a state or option that can be toggled.


HTML Attributes

  • checked = boolean
    Gives the default checkedness of the input element.


  • name = string
    Gives the name of the input element.


  • required = boolean
    When specified, the element is required.


  • value = string
    Gives the default value of the input element.


Example

Example A

[try it]

<label><input type="checkbox" name="ny"> New York</label>
<label><input type="checkbox" name="bos"> Boston</label>
<label><input type="checkbox" name="sfo"> San Francisco</label>
<label><input type="checkbox" name="dc"> Wasington DC</label>

Input checkbox01.png

HTML Reference

The HTML5 specification defines the Checkbox state in 4.10.7.1.16 CHECKBOX STATE.