Get a checkbox value - Javascript jQuery

Javascript examples for jQuery:Form Checkbox

Description

Get a checkbox value

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/* www.  j a v  a2s . c o m*/
$('#test').on('click', function() {
  $('#result').text($(this).is(':checked'));
});
    });

      </script> 
   </head> 
   <body> 
      <input type="checkbox" id="test"> 
      <div id="result"></div>  
   </body>
</html>

Related Tutorials