我對IE11和Jquery Validator有一個有趣的問題。它始於在輸入類型=「電子郵件」和輸入類型=「密碼」上發生的相同問題 - 似乎任何輸入BESIDES文本都會引發默認錯誤消息Please enter a value that is greater or equal to undefined
。使用jquery驗證器在IE11中進行密碼驗證中斷
因此,改變從電子郵件輸入類型爲文本的初審工作,但我不能更改密碼類型的文本 - 我不希望密碼顯示出來......
我不知道爲什麼會發生這種情況,或者未定義的變量來自哪裏 - 甚至不知道如何發現。有什麼建議麼?下面
代碼:
$.validator.addMethod("valid_pass", function(value, element, regexpr) {
return this.optional(element) || regexpr.test(value);
}, "Your password must be between 8-15 characters and contain at least 1 number.");
$("#element1").validate({
errorPlacement: function(label, element) {
label.appendTo(element.parent('td').siblings('td'));
},
rules: {
password: { required: true, valid_pass: /^(?=.*\d).{8,15}$/ },
password2: { required: true, equalTo: "#password" }
},
messages: {
password: { required: "Create a password." },
password2: {
required: "Re-enter your password.",
equalTo: "Your passwords do not match."
}
}
});
和
<tr>
<td class="align-right"> Password: <a class="tooltip ml5" title="Password must be between 8-15 characters & include at least 1 number">(?)</a></td>
<td><input type="password" id="password" name="password" maxlength="15" tabindex="9"/></td>
</tr>
<tr>
<td class="align-right"> Confirm password: </td>
<td><input type="password" name="password2" maxlength="15" tabindex="10"/>
</td>
</tr>