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

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -