Jquery Validation Plugin - can you enable “eager” validation from the options?

后端 未结 4 526
挽巷
挽巷 2020-12-29 12:27

I\'m using the Jquery Validation plugin on a project.

By default, the plugin validates input when the submit button is clicked. The behavior is \"lazy\" in order to

4条回答
  •  孤城傲影
    2020-12-29 12:57

    For me adding the onfocusout was also not working. I have tried to add it via setDefaults like suggested by KyleMit and via $('#myform').validate.

    The solution that I finally have used is to add an extra event on keyup, blur and change for the different fields of my form. I have used a class instead of an id to keep the logic generic.

    $('body').on('keyup blur change', '.tovalidate input, .tovalidate select, .tovalidate textarea', function () { 
            $('.tovalidate').validate().checkForm(); 
    });
    

提交回复
热议问题