我有一个Bootstrap模态和jquery.validate的问题,我使用模态引导程序的错误消息,窗体模式出现时窗体正确,这是我的Js代码,模态出现与淋浴功能
$("#form").validate({
errorElement: "em",
errorContainer: "#myModal",
errorPlacement: function(error, element) {
error.prependTo('#myModal');
},
rules: {
"tRemision": {
minlength: 5,
number: true
}
},
submitHandler: function(form) {
form.submit();
document.getElementById("b1").value = "Running...";
document.getElementById("b2").disabled = true;
return true;
},
errorLabelContainer: $("#myModal p"),
success: function() {
$('#myModal').modal("hide");
},
onblur: false,
onkeyup: false,
onsubmit: true,
onfocusout: false,
onkeyup: false,
onclick: false,
/*debug: true,*/
showErrors: function(errorMap, errorList) {
$('#myModal').modal();
this.defaultShowErrors();
}
});
答案 0 :(得分:0)
我用这个代码解决了我自己的问题,选项errorPlacement就是解决方案:
constructor