DjValidator is the most simple, flexible and quick to use jquery plugin for web form validation.

DjValidator 2: more simple, more powerful ...


Features:


Example:

Basic Usage:

  1. Add the jquery and djValidator scripts:
    	    		
    <script type="text/javascript" src="../lib/jquery/jquery.js"></script>
    <script type="text/javascript" src="../dist/DjValidator.js"></script>
    				
    	    	

    Download from the repository

    The plugin is also available in Npm and Bower .

    	    		
    npm i djvalidator
    				
    	    	

  2. Place the validation rules you need:
    	    		
    <input name="input1" type="text" data-dj-validator="atext,3,12" required>
    				
    	    	

    Add the validation rule in required fields with the data-dj-validator property , use the required attribute when the field is required:

    Check here all available validators.


  3. Use the plugin in any of these modes:

    Submit: The validation is executed in the form submit event, making automatic submission when form is valid, it also serves to validate fields, it is the default value:

    	    		
    //default mode is "submit"
    $('#form').djValidator();
    //validate only a field
    var resp=$('#input').djValidator();
    				
    	    	

    Function: The validation is executed immediately as a function, returns true or false according to result:

    	    		
    var resp=$('#form').djValidator({mode:’function’});
    				
    	    	

    Check here all available options.