A small validation library.
Download the development version.
In your web page:
<script src="jquery.js"></script>
<script src="dist/validator.js"></script>
<script src="dist/validator.init.js"></script>
<script src="dist/validator.config.js"></script>
<script>
jQuery(function($) {
$( document ).bind( "enhance", function(){
$( "body" ).addClass( "enhanced" );
});
$( document ).trigger( "enhance" );
});
</script>Add the required attribute to your input. Works with <input type="text"> (et al), <input type="checkbox">, <input type="radio">, <select>, and <textarea>.
Add the data-validate attribute with a validator key. Valid keys include: birthday (MM DD), ccexpiration (YYYY MM), credit, email, length (min, max using characters, selected options in a select, checked checkboxes, radios, words in a text input), numeric, password, passwordconfirm, phone, and zip.
To get all of the validation library, just run grunt from your
commandline. If you would like to specify which validator extensions
you'd like in your build, just use the --validators argument. Example:
grunt --validators="birthday zip email"
Check the demo
Run the tests