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

Similar Reads

Radio button:

It is generally used in HTML forms. HTML forms are required when you need to collect some data from site visitors. A radio button is used when you want to select only one option out of several available options....

Checkbox:

...

Difference between radio button and 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....

Contact Us