I am trying to disable all unchecked checkboxes when there are 5 checked checkboxes.
My code is not working here it is: http://jsfiddle.net/mtYtW/18/
My Jquery:
$('table input[type="checkbox"]').click(function(){
var countcheck = $('table input[type="checkbox"]:checked').length;
if(countcheck > 4) {
$("table input:checkbox:not(:checked)").attr("disabled", true);
}else
{
$("table input:checkbox").attr("disabled", false);
}
});
Working Example: http://jsfiddle.net/mtYtW/48/
NOTE: This code will enable the checkboxes if you deselect one of the five!