jQuery - Dynamically adding validation rule to multiple textboxes
- by Justin
Hey,
I'm trying to add a validation rule to multiple textboxes dynamically. Here's the js:
//validate form.
$("#SubmitForm").validate();
$("input[id*=Hours]").rules("add", {
number: true,
messages: {
number: "Please enter a valid Hours"
}
});
This applies the rule to the very first textbox on the page with "Hours" in the id but then it doesn't apply it to any of the other ones.
Anyone know what's wrong here?
Thanks,
Justin