我有一个带 2 个按钮的 sweetalert,但我想在其中多一个按钮。例如,截至目前,我有“是”和“否”,我想再添加一个按钮,请稍后再说。请帮忙。
$("#close_account").on("click", function(e) {
e.preventDefault();
swal({
title: "Are you sure?",
text: "You will not be able to open your account!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, close my account!",
closeOnConfirm: false
},
function() {
window.location.href="<?php echo base_url().'users/close_account' ?>"
});
});
提前致谢。
原文由 Sukhwinder Sodhi 发布,翻译遵循 CC BY-SA 4.0 许可协议
您应该使用带有 jQuery 事件绑定的自定义 HTML,它的工作原理几乎相同,唯一的问题是您需要自己为按钮添加样式,因为 SweetAlert 类对我不起作用。