On Click, find out if the element clicked is a checkbox - Javascript jQuery

Javascript examples for jQuery:Mouse Event

Description

On Click, find out if the element clicked is a checkbox

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(){/*from  w  w w.  j  a va 2s  .c o  m*/
$(function () {
    $(document).click(function (e) {
        console.log(e.target.type == 'checkbox');
    });
});
    });

      </script> 
   </head> 
   <body> 
      <input type="checkbox">  
   </body>
</html>

Related Tutorials