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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…