jQuery Validation not working in IE7 + IE8

magzalez picture magzalez · May 9, 2011 · Viewed 62.3k times · Source

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.

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>

Edit: 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 ({

Everything is working in IE, now. Thanks.

Answer

redsquare picture redsquare · May 9, 2011

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.