The HTML <input type=”checkbox”> is used to define a checkbox field. The checkbox is shown as a square box that is ticked when it is activated. It allows the user to select one or more option among all the limited choices.
Syntax:
<input type="checkbox">
Example:
html
<!DOCTYPE html>
< html >
< head >
< title >
Input type = "checkbox"
</ title >
</ head >
< body style="text-align: center;">
< h1 style="color:green;">
GeeksforGeeks
</ h1 >
< h2 ><input type="checkbox"></ h2 >
< form >
< input type="checkbox"
name="check"
id="GFG"
value="1"
checked>
Checked by default
< br >
< input type="checkbox"
name="check"
value="2">
Not checked by default
< br >
</ form >
< br >
</ body >
</ html >
|
Output:
Supported Browsers:
- Google Chrome
- Firefox
- Edge 12
- Internet Explorer
- Opera
- Apple Safari
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
12 Aug, 2022
Like Article
Save Article