jQuery - Dynamically adding validation rule to multiple textboxes -
I'm dynamically trying to add a verification rule to several text boxes. Here's the JS:
// Valid form $ ("# SubmitForm") valid () .; $ ("Input [id * = hours]"). Rule ("add", {number: true, message: {number: "please enter valid hours"}});
This rule applies to the first textbox on page with "hour" on ID, but then it does not apply to any other.
Does anyone know what's wrong here?
Thank you, Justin
You can add each matching the wildcard selector Item rule, such as:
$ ("# submitForm"). Valid (); $ ("Input [id * = hours]"). Each (function () {$ (this). Rule ("add", {number: true, message: {number: "Please enter valid hours"}});});
Hope it helps!
Comments
Post a Comment