The correct way to work with HTML5 checkbox


The following is the correct way −

<input name = "your_name" value = "your_value" type = "checkbox">

Example

Here is an example −

<!DOCTYPE html>
<html>
   <head>
      <title>Checkbox Control</title>
   </head>
   <body>
      <form>
         <input type = "checkbox" name = "maths" value = "on"> Maths
         <input type = "checkbox" name = "physics" value = "on"> Physics
      </form>
   </body>  
</html>

Updated on: 24-Jun-2020

122 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements