我已经在我的jQuery.validationEngine上实现了Sweetalert但是按钮"接受" sweetalert没有运行"提交",可以添加什么才能使其有效?
这是Sweetalert的代码:
$(document).ready(function(){
$("#id_form").validationEngine('attach',{
onValidationComplete:function(form, status){
if (status === true){
if(swal({title: "Confirm text?",text: "Another Text",type: "warning",showCancelButton: true,confirmButtonColor: "#DD6B55",confirmButtonText: "Accept",cancelButtonText: "Cancel"closeOnConfirm: true,closeOnCancel: false})){
form.validationEngine('detach');
submit();
}}}
});
})
没有Sweetalert并且正在运行:
$(document).ready(function(){
$("#id_form").validationEngine('attach',{
onValidationComplete:function(form, status){
if (status === true){
if(confirm("Confirm text?")){
form.validationEngine('detach');
submit();
}}}
});
})
参考文献:
答案 0 :(得分:0)
首先你应该在&#34之后插入逗号;取消"串。 根据以下
调整您的代码swal({
title: "Confirm text?",
text: "Another Text",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Accept",
cancelButtonText: "Cancel",
closeOnConfirm: true,closeOnCancel: false
}, function (isConfirm) {
if (isConfirm) {
return true;
} else {
return false;
}
});