我在播放框架中的表单上进行了 jquery 验证,当我直接单击提交按钮而不在文本框中输入值验证消息时,该框架工作正常。但问题是,当我从 datepicker(bootstrap-datepicker.js) 中选择日期时,日期字段的验证消息不会消失。点击两次后消失。请帮我。
Jquery Code:
$("form input.date").datepicker({
autoclose: true,
onClose: function() {
$(this).valid();
}
});
Validation Function:
$("#register").validate({
focusCleanup: true,
rules: {
name: "required",
email: {
required: true,
email: true
},
phone: {
required: true,
number:true,
minlength:10,
maxlength:10
},
date:{
required: true,
date: true
}
},
messages: {
name: "Please provide your full name",
email: {
required: "Please provide your email address",
email: "Please provide a valid email address"
},
phone: {
required: "Please provide your mobile number",
number: "Please provide a valid mobile number",
minlength:"Please provide a valid mobile number",
maxlength:"Please provide a valid mobile number"
},
date: {
required: "Please select date ",
date: "Please select valid date"
}
},
submitHandler: function(form) {
}
});