一个复选框只能正常工作。但是如何在 -> 组中的 validate() 函数中定义 3 个不同的复选框组:{ checks: "" }
这是我的代码
$(document).ready(function () {
$("#item").validate({
rules: { //some rules
},
groups: {
checks: "withe blue red",
checks: "gas tel sat",
checks: "cola fanta sprite"
},
messages: { //some messages
}
});
$.validator.addMethod('loc-sel-3', function (value) {
return $('.char-sel-3:checked').size() > 2;
}, '<?php _e("Please check at least 3 characteristic", "twitter"); ?>');
$.validator.addMethod('char-sel-3', function (value) {
return $('.char-sel-3:checked').size() > 1;
}, '<?php _e("Please check at least 2 features", "twitter"); ?>');
$.validator.addMethod('tech-sel-3', function (value) {
return $('.tech-sel-3:checked').size() > 0;
}, '<?php _e("Please check at least one box", "twitter"); ?>');
});