I have a asp.net form where I am trying to use Jquery Validation plugin. I am trying to add the rules using javascript using the rules method. so i tried something like this
$('#btnSave').on('click', function () {
$("#txtAmount").rules("add", {
required: true,
minlength: 2,
messages: {
required: "Required input",
minlength: jQuery.format("Please, at least {0} characters are necessary")
}
});
$('form').validate({
submitHandler: function (form) {
form.submit();
}
});
});
I have set the ClientIDMode="Static" so that i can use the contorl IDs directly. However, this is not working. Can anyone tell me where is the problem. I can't seem to put my finger on it.
here is a JsFiddle
$("#id1").rules("add", {I will continue testing the jsfiddle. bbiabShell form does not validate jsfiddleat the moment.