How woul开发者_开发问答d I add a custom submit function to a form to prevent it's normal action but so that it only runs after being validated by the jQuery Validation plugin?
You can use the submitHandler option of .validate(), like this:
$("form").validate({
  submitHandler: function(form) {
    //this runs when the form validated successfully
    form.submit(); //submit it the form
  }
});
There's also an invalidHandler if you want to run something when it doesn't pass validation.
In the event handler return true to proceed and return false to stop.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论