jslint中的jquery .validate错误

时间:2011-03-07 17:29:40

标签: jquery debugging

需要帮助,不确定这是否至关重要但是想要做对。我有以下addMethod,运行jslint时出现以下错误:     “第818行问题28:预期'{'而是看到'返回'。     } else return true;“

这是功能:

$.validator.addMethod(
            "InsideCanada",
            function(value, element) {
                var selectedCountry = $("#Country").val();
                if ($("#CNC1N").is(":checked") && (selectedCountry!=="CAN")) {
                    return false;
                } else return true;
            },
            "Cannnot select Toronto Stock Exch - In Canada."
        );

2 个答案:

答案 0 :(得分:2)

添加一些括号:else { return true; }

答案 1 :(得分:0)

为什么不呢:

return !($("#CNC1N").is(":checked") && selectedCountry!=="CAN");