Get to know if a check box input is checked - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form Event

Description

Get to know if a check box input is checked

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {/*from  www .  j  av  a  2 s .c om*/
document.getElementById('yousendit').onclick = function() {
    if (this.checked==true)
        console.log('checked');
}
    });

      </script> 
   </head> 
   <body> 
      <input type="checkbox" name="yousendit" id="yousendit" value="1">  
   </body>
</html>

Related Tutorials