JQuery的1.6 $('形式')验证()在IE7和放大器不工作。 IE8 [英] JQuery 1.6 $('form').validate() not working in IE7 & IE8

查看:120
本文介绍了JQuery的1.6 $('形式')验证()在IE7和放大器不工作。 IE8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新
我已经创建了剃刀HTML 5新的MVC 3的项目,那么我已经更新了的NuGet项目在JQuery的1.6和验证的插件不工作了,但是它一个回每一次并返回错误信息服务器。我想验证插件与破碎的 JQuery的1.6

我有一个MVC 3应用程序,使用jQuery UI的对话,以阿贾克斯信息提交给服务器(从含有一种形式的局部视图加载)。我想触发我在客户端形式的验证我做了ajax职位之前。在火狐和IE9正常工作,在IE7和放大器; IE8的form.validate()总是返回true。

I have a MVC 3 app that uses Jquery UI dialog (loaded from a partial view that contains a form) in order to submit information over ajax to the server. I want to trigger the validation of my form on the client side before I do the ajax post. On Firefox and IE9 works fine, in IE7 & IE8 the form.validate() always returns true.

下面是贴在我的提交按钮的JS code:

Here is the js code attached to my submit button:

    var wizard = $("#wizard"); //div that holds the modal dialog
    var myform = $("#wizard form");

    var submitFunction = function (e) {
        e.preventDefault(); //no postback
        myform.validate();
        if (myform.valid()) {
            $(this).attr("disabled", "disabled");
            submited = true;
            $.post(
                "SuperAdmin/CreateEditController",
                $(this).serialize(),
                function (data) {
                    if (data.Success) {
                        wizard.dialog('destroy');
                    }
                    else {
                        wizard.html(data.Html);
                    }
                },
                "json"
            ); //end json post
        }
    };
myform.submit(submitFunction);

我使用的是以下包括:

I am using the following includes:

<script src="@Url.Content("~/Scripts/jquery-1.6.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>

jQuery的验证插件在1.8.0版本和JQuery库的NuGet升级到1.6。

The JQuery Validation plugin was upgraded with NuGet at version 1.8.0 and JQuery library to 1.6.

更新
我测试过脚手架默认模板生成的code和它做同样的事情,没有客户端验证。也许JQuery的1.6是不是与剃刀脚手架模板??

Update: I've tested the code generated with scaffolding default template and it does the same thing, no client side validation. Maybe JQuery 1.6 is not compatible with the Razor scaffolding template ??

推荐答案

JQuery验证目前不使用jQuery 1.6 IE6,IE7和IE8工作。

Jquery Validate does not currently work with jQuery 1.6 in IE6, IE7, and IE8.

<一个href=\"https://github.com/jzaefferer/jquery-validation/issues/105\">https://github.com/jzaefferer/jquery-validation/issues/105

这篇关于JQuery的1.6 $('形式')验证()在IE7和放大器不工作。 IE8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆