HTML input checkbox

HTML input tag with type=checkbox can be used to create check box in html. It can also be nested in label tag. When inside label tag, it can be toggled by clicking anything which is part of label.


Some HTML attributes (in addition to global attributes) for input checkbox are

  • checked – The the checkbox is checked initially
  • disabled – The checkbox is disabled
  • value – The value which is sent to server as form data when checked. No value is sent when unchecked.

Example – input checkbox

<input type="checkbox" name=name1 value="value1" checked><br>
<input type="checkbox" name=name2 value="value2" checked disabled>

Example – input checkbox with label

Click wither on "Label1" or checkbox itself.<br>
  <input type="checkbox" value="value1" checked>


Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments