Search code examples
javascriptjqueryjquery-tools

How to check whether if the form is validated or not in Jquery-Tools validator


The return value from $("#myform").validator() is an object, is there a method in Jquery-Tools Validator like boolean $("#myform").isValid()?

Thanks


Solution

  • checkValidity is not a method of the jQuery object. It's a method of the the validator instance stored in the element's .data of the form (or input) element which you bound the validator to. Use:

    $('#myform').data("validator").checkValidity()
    

    To get the boolean representing the form's validity.

    Fiddle