点击esc按钮甜蜜警报不应该关闭

问题描述 投票:0回答:3

当用户点击esc警报不应该关闭时,他应该点击立即付款按钮进一步移动。

 if($unpaid==true){
     echo $print = '<script>
      function alertOn(){
swal({ 
        title: "No Membership Fees Received",
        text: "Please pay membership fees as per your selected package",
        type: "warning",
        confirmButtonText: "PAY NOW"

      },
      function(){
        window.location.href = "unpaid.php";
    });
};
window.onload = alertOn
</script>';
javascript php
3个回答
1
投票

是的,您可以通过将swalallowEscapeKey属性修改为allowOutsideClick来配置false函数,如:

swal({
       title: 'title',
       text: 'your text',
       showConfirmButton: true,
       allowEscapeKey : false,
       allowOutsideClick: false
    });

1
投票
if ($unpaid == true) {
    echo $print1 = '<script>
    function alertOn(){
        swal({ 
            title: "No Membership Fees Received",
            text: "Please pay membership fees as per your selected package",
            type: "warning",
            confirmButtonText: "PAY NOW",
            **allowEscapeKey:false**

          },
          function(){
            window.location.href = "unpaid.php";
        });
    };
    window.onload = alertOn;
</script>';
}

0
投票

我想对于这个版本你可以使用这个:

swal({
  title: 'title',
  text: 'your text',
  button: false,
  closeOnClickOutside: false,
  closeOnEsc: false
});

推荐问答