I am using the jQuery validate plugin to validate my form. As I see it (I'm having a hard time figuring things out from the documentation), I have 2 basic choices of how to apply a built-in validation rule:
Apply the class in the HTML
<input name="myNum" id="myNum" type="text" class="number" />
Specify the rule by input id when calling the validate method
$('#sales').validate({ rules: { myNum: {number: true} } });
Which is considered "best-practice"? I'm trying to decide if it's clearer to just code all the rules in one place in the validate method, so that I can see all my validation in one centralized location, or if it makes sense to code the simple rules in the HTML as classes and only put customized validation in the validate method. What is the more accepted way of coding the validation? What should determine when I use which method?