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");
?
精彩评论