jQuery验证无法在IE7 + IE8中运行 [英] jQuery Validation not working in IE7 + IE8

查看:108
本文介绍了jQuery验证无法在IE7 + IE8中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在表单上使用 jQuery Validation 插件在我的网站上。该表单适用于FF,Chrome,Opera和Safari。它还没有在IE7或IE8中运行。

I'm trying to use the jQuery Validation plugin on a form on my website. The form works in FF, Chrome, Opera and Safari. It has yet to work in IE7 or IE8.

下面是我的代码的简化版本,它似乎适用于每个浏览器,但IE。

Below is a simplified version of my code that seems to work in every browser but IE.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">

<title>Form</title>

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8/jquery.validate.js"></script>

<script type="text/javascript">
    $(document).ready(function(){
       var validator = $("form").validate ({
       rules: {
                first_name: "required"
              },
       messages: {
                first_name: "Enter your firstname"
                 }
       });
    });
</script>

</head>

<body>

<form method="post">
    <label for="first_name" class="hide">First Name</label> 
    <input type="text" name="first_name" value="" id="first_name" class="required" />
    <button type="submit" id="submit" name="submit">Submit</button>
</form>

</body>

</html>

编辑:我们现在知道使用jquery最新版本,我使用的是jQuery v1.6,是问题。我改回v1.5.2并更改了

We now know that using jquery latest, I was using jQuery v1.6, was the issue. I changed back to v1.5.2 and changed

var validator = $("form").validate ({

to:

$("form").validate ({

现在一切都在IE中运行。谢谢。

Everything is working in IE, now. Thanks.

推荐答案

我认为您需要回到早期版本的jquery(1.5.2)或使用较新版本的验证插件1.8.0.1。

I think you either need to move back to an earlier version of jquery (1.5.2) or use the newer version of the validation plugin 1.8.0.1.

这篇关于jQuery验证无法在IE7 + IE8中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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