<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 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 CHECKBOX STATE.

Last modified on 12 March 2012, at 14:33