HTML Form How to - Hide a checkbox








Question

We would like to know how to hide a checkbox.

Answer


<!DOCTYPE html>
<html>
<head>
</head><!--from  w  w w  .  j  av a  2s  .c om-->
<body>
  <label tabindex="0" class="checkbox">
      <input type="checkbox" 
             value="valueofcheckbox" 
             style="display: none" 
             checked="checked">Option Text</label>
</body>
</html>

The code above is rendered as follows: