jQuery Validity
A form validation jQuery plugin written in late 2015 (whatever that means).
This is heavily inspired by the Abide library (from the Zurb Foundation framework), but implemented completely from scratch and as a jQuery plugin, npm-ready and most of all not bloated.
Install
Using npm
:
npm install jquery-validity
Browserify and others:
var $ = $
ES2015 modules:
Usage
Options
There are the defaults:
$fnvaliditydefaults = attributeName: 'data-validators' errorClass: 'error' focusOnFirstError: true onSubmit: null parentSelector: 'p' requiredMessage: 'This field is required' timeout: 1000 // if `false`, no "live" validation validateOnBlur: true validators: {}
Events
$form $form
(TODO)
An example of an email validator function:
{ // A `validator` is a function that receives a `value` // and should return `null` if valid, or a message if not return { if validator return null return message }}
TODO
- Proper tests
- Finish documentation
- A better usage guide and examples
License
MIT