<input type="checkbox">
Browser |
|
---|---|
Type |
The INPUT element defines an input field. When you specify "checkbox" for the type attribute of this element, a checkbox is created.
<input type="checkbox" name="example" value="check1">Check1
<input type="checkbox" name="example" value="check2" checked>Check2
Attribute | Value | Explanation |
---|---|---|
type=" " | checkbox | the type of input field |
name=" " | field name | a unique name for the field |
value=" " | initial value | this value is submitted |
checked | checked | that checkbox is checked (HTML : checked | XHTML : checked="checked") |
- type="checkbox"
- Creates a checkbox on the form.
- name=""
- The field name is used to identify the form field. Several checkboxes can share the same field name, and the plural can be selected within that.
- value=""
- This value is submitted to the server when selected.
- checked
- That checkbox is checked in the initial state.