1//using plane javascript
2if(document.getElementById('on_or_off_checkbox').checked) {
3 //I am checked
4}
5
6//using jQuery
7if($('#on_or_off_checkbox').is(':checked')){
8 //I am checked
9}
1<form action="/action_page.php">
2 <input type="checkbox" name="vehicle1" value="Bike">
3 <label for="vehicle1"> I have a bike</label><br>
4 <input type="checkbox" name="vehicle2" value="Car">
5 <label for="vehicle2"> I have a car</label><br>
6 <input type="checkbox" name="vehicle3" value="Boat" checked>
7 <label for="vehicle3"> I have a boat</label><br><br>
8 <input type="submit" value="Submit">
9</form>