zzz
0
Q:

html checkbox


 <input type="checkbox" name="vehicle1" value="Bike"> I have a bike<br>
 <input type="checkbox" name="vehicle2" value="Car"> I have a car<br>
<input type="checkbox" name="vehicle3" value="Boat" 
  checked> I have a boat<br>
 
16
<!--
  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>
10
<form>
  <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>
</form>
2
<!doctype html>
<html>
  <body>
    
    <input type="checkbox">
    <input type="radio">
    
  </body>
</html>
0
<input type="checkbox" onchange="doSomething(this)">

function doSomething(element){
   var isChecked=element.checked;
	//do some action if it is checked
}
2
<input type="checkbox" onclick="checkFluency()"  id="fluency" checked />
0
<input type="checkbox" name="vehicle1" value="Bike">

The checkbox value is 'Bike'.
1

New to Communities?

Join the community