Don't forget to include jQuery library when run the following script
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>Firstly, sometime, you have to check a checkbox is checked or not to change some related element in form or load some component. Let's start with click event handling and "checked" attribute of checkbox
Demo checkbox click event handling
Check box hereSource code
HTMLJavascript
/**copy value when click on checkbox*/ $('#ct_checkbox').click(function(e){ if($(this).attr('checked') == 'checked'){ alert("unchecked !"); } else{ alert("checked !"); } $(this).attr('checked', !$(this).attr('checked')); });