我的html代码中有一个模态:
<div id="submitSuccess" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content alert-success">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">File A Defect</h4>
</div>
<div class="modal-body">
<p>Submitted successfully!</p>
</div>
<div class="modal-footer">
<button id="submitmodal" type="button" class="btn btn-default" onclick="submitForm()">Close</button>
</div>
</div>
</div>
</div>
然后我在我的js脚本中有这个验证,如果标题和描述没问题,我想先显示上面的模态,
$("#submitForm").validate({
rules: {
title: {
required: true
},
description: {
required: true,
},
},
errorPlacement: function(error,element) {
return true;
},
submitHandler: function(form) {
$('#submitSuccess').modal("show");
if(('#submitmodal').trigger( "click" )){
form.submit();
}else{
event.preventDefault();
}
},
});
我想要的是当模态显示时,你需要先点击
<button id="submitmodal" type="button" class="btn btn-default">Close</button>
在提交表格之前