I am using MVC Data Validation for TextBoxFor and DropDownListFor and its working nice. But I also wanted to add jquery validation for checkbox list is there a way to add that as well? In my document.ready function I call ready validate(); which add the validator.addMethod but it is not firing.
<button type="submit" class="btn btn-primary px-4 float-right">Save</button>
$(document).ready(function () {
validate();
}
var validate = function () {
$.validator.addMethod("sources", function (value, elem, param) {
if ($("[name='chkProduct']:checkbox:checked").length > 0) {
return true;
} else {
return false;
}
}, "You must select at least one!");