You can do it as follows:
$('#checkbox_id').click(function(){ alert(this.checked); });
Or using the is() method:
$('#checkbox_id').click(function(){ if ($(this).is(':checked')){ alert('Checked'); } else{ alert('Not Checked'); } });
If you want to do this for all the :checkbox inside the form, you can use the filter selector :checkbox as follows:
$('#form_id :checkbox').click(function(){ alert(this.checked); });
Be sure to wrap your code in a ready-made handler:
$(function(){
Sarfraz
source share