我尝试了 sweeAlert插件,它运行良好,但在确认后我无法弄清楚如何做默认的东西。
$(document).ready(function () {
function handleDelete(e){
e.preventDefault();
swal({
title: "Are you sure?",
text: "You will not be able to recover the delaer again!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete!",
closeOnConfirm: false
},
function (isConfirm) {
if (isConfirm) {
return true;
}
});
};
});
和按钮
<a href="{plink delete! $row->id_dealers}" class="delete" onclick"handleDelete(event);"> </a>
//{plink delete! $row->id_dealers} Nette -> calls php delete handler
我也尝试过unbind()
,off()
而不是return false
,不起作用。之前我使用confirm()
withreturn true
和return false
inonclick
属性,它可以工作,但看起来很糟糕。