I recently had a question on getting checkbox validation working on the client side within a MVC project. This question was successfully answered, but raised another query.
I have no problem adding this code to an external javascript file, which i pilfered from This site
// Custom validator for checkboxs
jQuery.validator.unobtrusive.adapters.add("brequired", function (options) {
//bool-required for checkboxes
if (options.element.tagName.toUpperCase() == "INPUT" &&
options.element.type.toUpperCase() == "CHECKBOX")
{
options.rules["required"] = true;
if (options.message) {
options.messages["required"] = options.message;
}
}
});
Are you certain that you put your script AFTER the jquery scripts in your page? Mine is the last in the list.