[英]JQuery validation not working in IE 11
我正在嘗試使用PHP的jquery validate來驗證表單。 我已經用google完成了所有這些工作……我是Web開發的新手。該窗體在FF中可以正常工作,但該腳本在IE 11中不起作用。幫助我...謝謝...代碼如下:
<script src="js/jquery-1.9.0.js"></script>
<script src="js/jquery.validate.min.js"></script>
<!-- jQuery Form Validation code -->
<script>
// When the browser is ready...
$function() {
// Setup form validation on the #register-form element
$("#register-form").validate({
// Specify the validation rules
rules: {
topic: "required",
detail: "required",
name: "required",
email: {
required: true,
email: true
},
},
// Specify the validation error messages
messages: {
topic: "Enter the subject for your suggestion",
detial: "Please enter your suggestion",
name: "Please enter your name. It will be kept hidden",
email: "Please enter a valid email address",
/* username: "Please enter a valid username",
password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
}*/
},
submitHandler: function(form) {
form.submit();
}
});
});
</script>
<table align="center" width="800px" border="1" class="table_css">
<?php echo $output; ?>
<!-- The form that will be parsed by jQuery before submit -->
<tr><td >Submit Your Suggestion</td></tr>
<tr><td>
<form action="add_topic.php" method="post" id="register-form" name="register-form" novalidate>
<div class="label">Subject</div><input type="text" id="topic" name="topic" value="<?php echo $topic; ?>" size="50"/><br />
<div class="label">Suggestion</div>
<textarea name="detail" cols="60" id="detail" rows="15" value="<?php echo $detail; ?>"></textarea><br />
<div class="label">Name</div><input type="text" id="name" name="name" value="<?php echo $name; ?>" size="30" /><br/>
<div class="label">Email</div><input type="text" id="email" name="email" value="<?php echo $email; ?>" size="30"/><br /><div style="margin-left:200px;"><input type="submit" name="submit" value="Submit" /><input type="reset" name="Submit2" value="Reset" /></div>
</form>
</td>
</tr>
</table>
我有類似的問題。 我添加了以下代碼來設置瀏覽器與Internet Explorer的兼容性,以使其運行。 在<head>
標記中添加以下代碼。
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
它使腳本可以在IE11中使用。
更改提交按鈕的名稱
<input type="submit" name="submit" value="Submit" />
除了提交以外
<input type="submit" name="btnSubmit" value="Submit" />
從另一個線程來看,IE似乎無法很好地處理過多的逗號。 嘗試刪除郵件和規則對象中email
屬性后的逗號。
1.18.0版中的https://github.com/jquery-validation/jquery-validation/issues/2225問題
一個安全的解決方案是安裝1.17.0版-> npm install jquery-validation@1.17.0並檢查插件是否確實是1.17.0版
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.