你可以在你的表格上。。。
<form id="myform" action=".." method=".." onsubmit="return validateForm(this);">
.....
</form>
现在假设您正在使用jquery表单验证插件
function validate(formObj){
v = $(formObj).validate({ // initialize the plugin
rules: { //enter additional rules.
input1: {required: true, email:true},
input2: {required: true, integer:true}
},
submitHandler: function(formObj) {
$('#myform').removeAttr('onsubmit'); //remove the onsubmit attr..
$(modal).addClass('active'); //then show the modal here..
}
});
return false; //which stops the form from submitting..
}
现在让我们假设模式已经弹出,用户已经接受了协议并单击了agree按钮,然后触发表单并发送它
function sendFromModal(){
$('#myform').submit();
return true; //
}