jQuery - How to dynamically add a validation rule

Posted by Justin on Stack Overflow See other posts from Stack Overflow or by Justin
Published on 2010-06-13T21:07:36Z Indexed on 2010/06/13 21:12 UTC
Read the original article Hit count: 273

Filed under:

Hey, 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

© Stack Overflow or respective owner

Related posts about jQuery