html checkbox status
snippet in html

html checkbox

user775

<!--
  You can group and post different values with the same "name".
  When posted to PHP, all checked boxes' values will appear under
  the "peripherals" element in `$_POST` array.
  E.g. if we check "screen" & "keyboard" and post the form then
  `$_POST` will contain `['peripherals' => ['screen', 'keyboard']]`
-->
<form>
  <input type="checkbox" id="periph1" name="peripherals" value="screen">
  <label for="periph1"> I have a Screen</label>
  <input type="checkbox" id="periph2" name="peripherals" value="keyboard">
  <label for="periph2"> I have a Keyboard</label>
  <input type="checkbox" id="periph3" name="peripherals" value="mouse">
  <label for="periph3"> I have a Mouse</label>
  <button type="submit">Send</button>
</form>

javascript checkbox checked

user7346

if(document.getElementById('on_or_off_checkbox').checked) {
    //I am checked
}else{
	//I am not checked
}

checkbox checked if condition javascript

user8053

if (document.getElementById('id of the check box here').checked) {
	// it is checked. Do something
} else {
	// it isn't checked. Do something else
}

if ($('input[name="transport"]').is(':checked')) {
	alert('checked');
	alert($(this).attr('id')); //To get ID of checkBox
}

html checkbox status

user8615


    <form 
    action="/action_page.php">

   <input type="checkbox" name="vehicle1" value="Bike">
  <label 
    for="vehicle1"> I have a bike</label><br>
  <input type="checkbox" 
    name="vehicle2" value="Car">
  <label for="vehicle2"> I have a 
    car</label><br>
  <input type="checkbox" name="vehicle3" 
    value="Boat" checked>
  <label for="vehicle3"> I have a 
    boat</label><br><br>
  <input type="submit" value="Submit">

    </form>
 

html checkbox status

user1088

app.innerHTML = '<h1>Hello, world!</h1>';