concept validation rule in category jQuery

appears as: validation rules, validation rules, validation rule, The validation rules
Extending jQuery

This is an excerpt from Manning's book Extending jQuery.

In this book I explain how you can extend various aspects of jQuery to provide greater reuse and easier maintenance of your code. Alongside the standard plugin that operates on a collection of elements on a web page, you can create custom selectors, utility functions, custom animations, enhanced Ajax processors, custom events, and validation rules. I cover testing, packaging, and documenting your code to make sure that others can make maximum use of it as well.

14.1.1. Assigning validation rules

This plugin allows you to assign validation rules to fields in a number of different ways, allowing for flexibility in your page design and framework usage. The two main methods of assignment are via classes and attributes attached to the fields (metadata), and via the rules option in the plugin initialization.

Listing 14.2. Applying validation rules during initialization