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

前端 未结 7 1802
余生分开走
余生分开走 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条回答
  • 2020-11-29 20:04

    2015 answer: we have this out of the box on modern browsers, just use the HTML5 CheckValidity API from jQuery. I've also made a jquery-html5-validity module to do this:

    npm install jquery-html5-validity
    

    Then:

    var $ = require('jquery')
    require("jquery-html5-validity")($);
    

    then you can run:

    $('.some-class').isValid()
    
    true
    
    0 讨论(0)
提交回复
热议问题