sweetalert 2上有2个以上的按钮

我有一个带有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="" }); }); 

提前致谢:)

你应该使用带有jQuery事件绑定的自定义HTML,它的工作方式几乎相同,只需要自己为按钮添加样式,因为SweetAlert类对我不起作用。

 $(document).ready(function() { $("#close_account").on("click", function(e) { var buttons = $('
') .append(createButton('Ok', function() { swal.close(); console.log('ok'); })).append(createButton('Later', function() { swal.close(); console.log('Later'); })).append(createButton('Cancel', function() { swal.close(); console.log('Cancel'); })); e.preventDefault(); swal({ title: "Are you sure?", html: buttons, type: "warning", showConfirmButton: false, showCancelButton: false }); }); }); function createButton(text, cb) { return $('').on('click', cb); }
     

以上答案对我不起作用,所以我做了以下几点:

  $(document).on('click', '.SwalBtn1', function() { //Some code 1 console.log('Button 1'); swal.clickConfirm(); }); $(document).on('click', '.SwalBtn2', function() { //Some code 2 console.log('Button 2'); swal.clickConfirm(); }); $('#ShowBtn').click(function(){ swal({ title: 'Title', html: "Some Text" + "
" + '' + '', showCancelButton: false, showConfirmButton: false }); });
 .customSwalBtn{ background-color: rgba(214,130,47,1.00); border-left-color: rgba(214,130,47,1.00); border-right-color: rgba(214,130,47,1.00); border: 0; border-radius: 3px; box-shadow: none; color: #fff; cursor: pointer; font-size: 17px; font-weight: 500; margin: 30px 5px 0px 5px; padding: 10px 32px; }