Horje

How to add HTML <input type="checkbox">

checkbox Defines a checkbox

Let the user select one or more options of a limited number of choices.

Definition and Usage

The <input type="checkbox"> defines a checkbox.

The checkbox is shown as a square box that is ticked (checked) when activated.

Checkboxes are used to let a user select one or more options of a limited number of choices.

Tip: Always add the <label> tag for best accessibility practices!


Browser Support

Syntax

<input type="checkbox">

index.html
Example: HTML
<input type="checkbox" id="vehicle1" name="vehicle1" value="Bike">
<label for="vehicle1"> I have a bike</label><br>
<input type="checkbox" id="vehicle2" name="vehicle2" value="Car">
<label for="vehicle2"> I have a car</label><br>
<input type="checkbox" id="vehicle3" name="vehicle3" value="Boat">
<label for="vehicle3"> I have a boat</label><br> 

Output should be:

How to add HTML <input type="checkbox">




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Tag
Uploaded by:
Admin