HTML Checkbox Control

  • Check boxes allow the user for choosing multiple options from several available options.
  • They are also created using HTML <input> tag but type attribute is set to checkbox.
  • Syntax:

    <input type= "checkbox" name= "any name" value= "any value" />

  • Here is an example of checkbox control which will show three checkboxes with names playing,singing and dancing respectively:


<!DOCTYPE html>
<form >
<input type= "checkbox" name= "hobbies" value= "play" /> Playing<br />
<input type= "checkbox" name= "hobbies" value= "sing" /> Singing<br />
<input type= "checkbox" name= "hobbies" value= "dance"/> Dancing<br/>

To see live output : Visit Try Yourself Editor



Here is the list of Attributes for creating checkbox control:

Attribute Description
type (Required) It defines which input field to create.for checkbox input control it will be set to checkbox.
name (Optional) It is important as the field will be identified in the other file or server by the value of this attribute.
value (Optional) The value that will be used if the checkbox is selected.
disabled (Optional) It specifies that the input field will be disabled. Generally, it is used alone without any value.
checked (Optional) It will specify that these will be shown checked initially. Generally, it is used alone without any value.