$('form').submit(function(){ $(':input[name="updated[]"', this).each(function () { var id = $(this).attr('class'); if($(':input[name="updated[]"').is('checked')){ //Do nothing. } else { $(':input[class="'+id+'"]').attr('disabled', true); } }); });