Prevent SweetAlert to be closed on clicking outside the popup window

前端 未结 13 809
不知归路
不知归路 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 04:44

    Use backdrop:true with the allowOutsideClick: false as following below. It worked for me.

    swal({
        backdrop:true,
        allowOutsideClick: false,
        title:'Warning!',
        text:'Do you want to delete records?',
        type:'warning',
        showCancelButton: 0,
        confirmButtonText: 'OK',
    }).then(function(e) {
        if (e.value) {
            //do what you want
        }
    })
    

提交回复
热议问题