以下に全体を貼り付けた私のフォームは、IE8で検証されません。エラーはありません -- 検証は無視されるため、人々は何でも送信できます。jquery 1.8.1 と検証プラグイン バージョン 1.9 を使用しています。構文の問題ですか?IE9、Chrome、Firefox では問題ありません。
どこに問題があるのかわからないので、すべてを以下に貼り付けます。
<!DOCTYPE HTML>
<html>
<head>
<!-- HTML5 biolerplace stuff below -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="">
<meta name="viewport" content="">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<script src="js/vendor/modernizr-2.6.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="js/vendor/jquery.defaultvalue.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.js"></script>
<style>
#formwrapper {
height:275px;
width:250px;
background-color: #f8f8f8;
border: 1px solid #cccccc;
padding: 25px 0 25px 25px;
font-family: arial;
font-size: 12px;
}
.entry {
border: 1px solid #cccccc;
margin: 5px 0;
width: 212px;
/* height: 26px; */
color: black;
padding: 7px 0 7px 10px;
}
#form_title, #button {
font-size: 18px;
}
#form_title {
color: #00589f;
margin-bottom: 20px;
}
#button {
width: 80px;
height: 24px;
position: relative;
left: 143px;
top: 15px;
background-color: #00589f;
border: none;
color: white !important;
}
.error {
border: 1px solid red;
background:#FFFFFF;
content: "text"
}
.empty {
color: #ccc;
}
</style>
<script type="text/javascript">
//form validation start
$(document).ready(function() {
//$('form').submit(function(){
// $('.incomplete').val('');
//});
//reject default values
$("#form").validate({
wrapper: ".formwrapper",
keyup: false,
//onfocusout: false,
//onclick: false,
//onchange: false,
errorLabelContainer: ".form",
//errorClass: "incomplete",
rules: {
organization: {
required: true,
minlength: 2
},
firstname: {
required: true,
minlength: 2
},
lastname: {
required: true,
minlength: 2
},
email: {
required: true,
email: true
},
phone: {
required: true,
minlength: 10,
digits: true
}
}
});
});
</script>
</head>
<body>
<div id="formwrapper">
<div id="form_title">REQUEST INFO</div>
<form id="form" name="form_container" action="#">
<!-- fields -->
<input class="entry" id="organization" type="text" name="organization" placeholder="Organization"/>
<input class="entry" id="firstname" type="text" name="firstname" placeholder="First Name"/>
<input class="entry" id="lastname" type="text" name="lastname" placeholder="Last Name"/>
<input class="entry" id="email" type="text" name="email" placeholder="Email"/>
<input class="entry" id="phone" type="text" name="phone" placeholder="Phone"/>
<!-- submit button -->
<input id="button" class="button" type="submit" value="Submit" />
</form>
</div>
<script>
//talks to defaultvalue plugin to make placeholders work in IE
$('#organization, #firstname, #lastname, #email, #phone').defaultValue();
</script>
</body>
</html>