开发者

jquery .validate error in jslint

Need help, not sure if this is critical but want to get it 开发者_Go百科right. I have the following addMethod, and I get the following error when running through jslint: "Problem at line 818 character 28: Expected '{' and instead saw 'return'. } else return true;"

Here's the function:

$.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."
        );


Add some brackets: else { return true; }


Why not just:

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

?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜