Prevent SweetAlert to be closed on clicking outside the popup window

前端 未结 13 771
不知归路
不知归路 2021-02-01 04:40

I am using Sweet Alert for a popup on my product view in an E-commerce Application with two buttons: one for going on cart View and another for reloading the vi

13条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-01 05:08

    If you wan't want to close dialog on esc or outside click below is working for me.!

    swal({
      title: "Are you sure?",
      text: "You will not be able to recover this details!",
      icon: "warning",
      closeOnClickOutside: false,
      closeOnEsc: false,
      allowOutsideClick: false,
      buttons: [
        'No, cancel it!',
        'Yes, I am sure!'
      ],
      dangerMode: true,
    })
    

提交回复
热议问题