当我单击取消按钮时,我想删除或清除错误消息并重置 jquery 验证。
在这里,我给出了我的代码:
$(document).ready(function() {
var validator = $("#loginForm").validate({
messages: {
email: {
required: "Please enter email.",
email: "Please enter a valid email."
},
password: "Please enter password."
}
});
<form name="loginForm" id="loginForm" method="post" action="javascript:login();">
<div class="login_contain_div">
<div id="login_errors" class="errors"></div>
<div class="login_contain_inner">
<span style="font-size: 20px; font-weight: lighter;">Email</span>
<input type="text" id="email" name="email" class="inputbg required email" />
<br/>
<span style="font-size: 20px; font-weight: lighter;">Password:</span>
<input type="password" id="password" name="password" class="inputbg required" />
</div>
<div class="login_button_area">
<input type="submit" id="login_submit" class="login_greenbtn button_float_left login_btn_width" name="submit" value="Ok" style="cursor: pointer;" />
<a class="ptr login_greenbtn button_float_right login_btn_width" onClick="$('#cboxClose').click();">Cancel</a>
</div>
</div>
</form>