$('.quest_1').click(function() { var bol = $('.quest_1:checked').length >= " . $qMax . "; $('.quest_1').not(':checked').attr('disabled',bol); });