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:
$(':checkbox').bind('click', function(){ if($(':checkbox:checked').length >= 5) { $(':checkbox').not(':checked').prop('disabled', true); } else { $(':checkbox').not(':checked').prop('disabled', false); } });
Note that prop is jQuery 1.6 exclusive. In case of jQuery < 1.6 use attr.
prop
attr