I have a set of 4 checkboxes, all with different names, and require that at least 1 is checked.
I have set the class on all of them to \'require-one\'.
Swatting a fly with a rocket launcher?
$('.require-one:checked').size() == 0;
Apply the rule on any one of the checkboxes using it's name. For the form to be valid, this checkbox must pass validations. For this checkbox to be valid, at least one of the 4 checkboxes must be checked.
$("#itemForm").validate({
rules: {
'check1': {
required: {
depends: function(element) {
return $('.require-one:checked').size() == 0;
}
}
}
}
});
Updated 2:
http://jsfiddle.net/MkPtP/1/