JQuery Validation PlugIn - submitHandler syntax

百般思念 提交于 2019-12-24 17:08:54

问题


I am using asp.net mvc 3 client validation. I am trying to do some stuff before any form is submitted. I found JQuery's validation has a submitHandler that seems to be what I am looking for but I am having problems with the syntax. T

I've tried the following but I get a syntax error.

 $(function () {
    submitHandler: function (form) {
      //my logic
      alert('here');
    }
  });

Thanks for any help!!!


回答1:


You need to call this as part of the .validate() options, like this:

$(function() {
  $("#formID").validate({
    submitHandler: function(form) {
      //my logic
      alert('here');
    }
  });
});


来源:https://stackoverflow.com/questions/4505366/jquery-validation-plugin-submithandler-syntax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!