0

一个复选框只能正常工作。但是如何在 -> 组中的 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"); ?>');
});
4

1 回答 1

0

我找到了解决方案。不同的名字。

组:{颜色:“withe blue red”,tech:“gas tel sat”,drink:“cola fanta sprite”},

于 2013-11-06T12:19:02.803 回答