Parsley.js is a simple powerful javascript form validator, Parsley has a full support for #UX concerns and detailed options. You can override almost every Parsley default behaviors to fit your exact needs.

The simple code in below shows how to create custom validator for parsley.


    // Waiting for the DOM ready...
    $(function(){

      // Add your custom validators
      $('#my-form').parsley({

        // define your custom validators here
        validators: {
          multiple: function(val, multiple) {
            return val % multiple === 0;
          }
        },

        // define your custom validators error messages here
        messages: {
          multiple: "This value should be a multiple of %s"
        }
      });
      
    });