Checkbox and Radio Button Groups
Let users pick one or many options from a group.
Checkboxes
Checkboxes let users select zero, one, or many options:
<label>
<input type="checkbox" name="terms" value="agreed"> I agree to the Terms
</label>
<!-- Each checkbox is independent -->
<!-- checked attribute = pre-checked -->
<input type="checkbox" name="newsletter" value="yes" checked>Checkbox Submission
Checkboxes only submit if checked:
<form>
<input type="checkbox" name="hobby" value="reading"> Reading<br>
<input type="checkbox" name="hobby" value="coding"> Coding<br>
<input type="checkbox" name="hobby" value="gaming"> Gaming<br>
</form>
<!-- If reading and coding are checked:
hobby=reading&hobby=coding -->
<!-- Unchecked boxes send nothing -->All lessons in this course
- Select and option Dropdown Menus
- Textarea for Multi-line Input
- Checkbox and Radio Button Groups
- Datalist for Autocomplete