Simple Fast Form Validation Plugin For jQuery - jqueryValidate

File Size: 5.59 KB
Views Total: 2382
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Simple Fast Form Validation Plugin For jQuery - jqueryValidate

A simple, easy, fast jQuery plugin that adds client-side form validation functionality to existing form fields. Currently supports validating required, email, match and minlengh form inputs. Compatible with any CSS frameworks.

How to use it:

1. Download and include the jqueryValidate.js script after you've included jQuery library.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="js/jqueryValidate.js"></script>

2. Add validation rules to your existing form fields using data-validation attribute as follows:

<input type="text" name="name" data-validation="required">
<input type="text" name="email" data-validation="required email">
<input type="password" name="pass" id="pass1" data-validation="required min-length" data-validation-length="8">
<input type="password" name="pass2" data-validation="required match" matchid="pass1">

3. Active the form validation plugin.

$("#form").validate();

4. Callback functions.

$("#form").validate({
  callback:function (input){},
  validCallback:function (input){},
  successEnable:false,
  success:function (data){}
});

5. Customize the error messages.

en:{
  required:"Required field.",
  email:"Invalid Email address.",
  match:"Fields do not match.",
  minlength:"Requires at least %s caracteres."
}

This awesome jQuery plugin is developed by ivanhuay. For more Advanced Usages, please check the demo page or visit the official website.