how to check if a form is valid programmatically using jQuery Validation Plugin

前端 未结 7 1829
余生分开走
余生分开走 2020-11-29 19:11

I have a form with a couple of buttons and I\'m using jQuery Validation Plugin from http://jquery.bassistance.de/validate/. I just want to know if there is any way I can che

7条回答
  •  -上瘾入骨i
    2020-11-29 19:55

    @mikemaccana answer is useful.

    And I also used https://github.com/ryanseddon/H5F. Found on http://microjs.com. It's some kind of polyfill and you can use it as follows (jQuery is used in example):

    if ( $('form')[0].checkValidity() ) {
        // the form is valid
    }
    

提交回复
热议问题