jQuery 验证在 IE7 + IE8 中不起作用 [英] jQuery Validation not working in IE7 + IE8

查看:25
本文介绍了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 ({

到:

$("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天全站免登陆