我有一个简单的表格,需要确认电子邮件,如果没有错误,它会很好用。但是,如果我提交错误 jquery 验证插件正在添加 display:none 到确认电子邮件输入。它不会添加无效的类,不确定发生了什么。
JS:
$("#customer-info").validate({
调试:真,
错误元素:“”,
提交处理程序:函数(表单){
//TODO需要一个处理图像
$.post(form.action, $(form).serialize(), function(result) {
如果(结果 > 0){
// 做一些事情
}
},"json")
返回假;
}
});
html:
<form id="customer-info">
<label for="customer-name">Name</label>
<input type="text" id="customer-name" name="customer-name" placeholder="first last name" class="required" /><br />
<label for="customer-email">Email</label>
<input type="text" id="customer-email" name="customer-email" placeholder="email@gmail.com" class="required email" /><br />
<label for="confirm-email">Confirm Email</label>
<input type="text" id="confirm-email" name="confirm-email" placeholder="email@gmail.com" class="required email" equalTo="#customer-email" /><br />
<label for="notes">Notes</label>
<textarea id="notes" name="notes" placeholder="Any additional details or changes."></textarea><br />
<center><input type="submit" value="Go" class="btn-go" /></center>
</form>