When I click on Problem, both check boxes must select/deselect. I want to select and deselect check boxes for multiple time. It works only for selecting and then deselecting (2 times) and then is not working any more.

My code:
$(document).ready(function() { $('#CHECK-ALL').click(function() { if ($(this).is(':checked')) { $('#P').attr('checked',true); } else { $('#P').attr('checked',false); } }); });