I’m trying to dynamically add a validation rule to some dynamic controls:
$("input[id*=Hours]").rules("add", "required");
However this line gives me the following error:
$.data(element.form, “validator”) is null
Defining rules the static way with the validate function works fine. What am I doing wrong?
Thanks,
Justin
You need to call
.validate()before you can add rules this way, like this:The
.validate()documentation is a good guide, here’s the blurb about.rules("add", option):