Warning:
This wiki has been archived and is now read-only.

Elements/input/checkbox

From HTML Wiki
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>


HTML Reference

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