Checkbox
Checkboxes are also mostly used in HTML forms. A checkbox allows you to choose one or many options to be selected from a list of options.
Example 2: In this example, we will see the use of checkboxes with an example.
html
<!DOCTYPE html> < html lang = "en" > < head > < title >HTML Checkboxes</ title > </ head > < body > < form > Choose languages you know: < br > < input type = "checkbox" name = "C" value = "yes" >C < br > < input type = "checkbox" name = "C++" value = "yes" >C++ < br > < input type = "checkbox" name = "Java" value = "yes" >Java < br > < input type = "checkbox" name = "Python" value = "yes" >Python < br > < input type = "Submit" > </ form > </ body > </ html > |
Output:
Radio Button Vs Checkbox in HTML
Radio buttons allow users to select only one option from a group, while checkboxes permit multiple selections. Use radio buttons when exclusive choices are needed, and checkboxes for multiple independent choices.
Table of Content
- Radio button
- Checkbox
Contact Us