Query only page (VERSION 1)

Please use version 2

Basic Usage:

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

    Download from repository

    The plugin is also available on Npm and Bower .

    	    		
    npm i djvalidator
    				
    	    	

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

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

    Show here all available validators.


  3. Use the plugin in any of these modes:

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

    	    		
    $('#form').djValidator();
    				
    	    	

    Callback:Validation is executed in submit event, avoids sending and executes parameter function if it is valid:

    	    		
    $('#form').djValidator('callback',function($form){
    				alert("Callback executed when the form is valid.");
    			});
    
    				
    	    	

    Function:Validation is executed immediately as a function, returns true or false depending on the result:

    	    		
    var resp=$('#form').djValidator('validate');
    				
    	    	

    Field:Validation is done only on a field at the moment of executing the plugin, returns true or false according to the result:

    	    		
    var resp=$('#input1').djValidator('field');
    				
    	    	

    Clean(v1.1.0):Delete all validation messages placed by the validator (cleaning):

    	    		
    $('#form').djValidator('clean');