Additonal options - mosbymc/validator GitHub Wiki
Scroll Listener
If the form or input is displayed inside of a scrollable container like a modal or popup, an attribute called “data-modalid” can be added so that the validator listens to the scroll event of the modal in addition to window. The value should be set to the id of the popup container. This will ensure that the error messages’ locations are moved along with both the window and modal when scrolled. This will also stop displaying the error message div when the input is scrolled “above” or “below” the popup in the case of fixed position divs.
<input type="text" data-validationrules="name" data-modalid="modal" class="inputValidate"/>
Input success function
Like the form level validation, an input can have a success function called when it is successfully validated. Because the validator listens to the input event by default when validating a single input, the success function should be used with caution as the input could go in and out of a valid state while typing. To add a success function to an input give it an attribute called “data-inputaction” with the value being the string name of the function the validator should call; the same way as the formaction attribute.
<input type="text" data-validationrules="name" data-inputaction="showElement" data-validateon="input" class="inputValidate"/>
Removing error messages programmatically
By default, the validator will remove all error messages each time an input is validated, and only display the errors for which the input failed validation. However, you may want to remove validation errors when a user action takes place that should reset the validation or makes the validation moot; like when closing a modal that has failed validation. In this case, call the validator function “removeErrors”. If no parameter is passed in, the validator will remove all error messages from the body of the document.
validator.removeErrors();
If you would like to remove the errors from just one form, you can either pass in a CSS/JQuery selector, or a Jquery DOM object, and the removeErrors function will remove all errors from just that element.
validator.removeErrors("#form1");
or
var form = $("$form1");
validator.removeErrors(form);
Continue to: Adding new event listeners