Can someone tell me why this form validation works in Firefox and not in Internet Explorer?
I need to make it work on ALL browsers.
Currently. the form is being submitted on explorer without validation.
Thanks for your assistance.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Simple Form Validation</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#form2").validate({
rules: {
name: "required",// simple rule, converted to {required:true}
email: {// compound rule
required: true,
email: true
},
url: {
url: true
},
comment: {
required: true
}
},
messages: {
comment: "Please enter a comment.",
name: "upgrade",
email: "valid email only"
}
});
});
</script>
</head>
<body>
<form id="form2" method="post" action=""><br />
Name * <input type="text" name="name" /> <br />
E-Mail *<input type="text" name="email" /> <br />
URL <input type="text" name="url" /> <br />
Your comment * <textarea name="comment" ></textarea> <br />
<input class="submit" type="submit" value="Submit">
</form>
</body>
</html>
Try this, I think your syntax was a bit off.