Javascript Form How to - Get if the checkbox is checked








Question

We would like to know how to get if the checkbox is checked.

Answer


<!DOCTYPE html>
<html>
<body>
  <input type="checkbox" id="chkLoad">
    <script type='text/javascript'>
    <!--  w  w w  . ja va 2 s  . c  o m-->
    document.writeln(chkLoad.checked)
    
    </script>  
</body>
</html>

The code above is rendered as follows: