本文介绍了jQuery验证插件 - submitHandler语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用asp.net MVC 3客户端验证。我想提交任何形式之前,做一些东西。我发现jQuery的验证了,这似乎是我所期待的,但我有语法问题submitHandler。 ŧ

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');
    }
  });

感谢您的帮助!

推荐答案

您需要调用此作为的选项,如下所示:

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

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

这篇关于jQuery验证插件 - submitHandler语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 04:04