1

I'm using the example in this answer to display more than just 2 buttons on a swal. When the user clicks the deny button, I want to change something in the html of the swal without closing it. Right now, the swal is closed when the deny button is clicked. Where and how do I specify that the swal shouldn't close?

Patrick
  • 1,635
  • 2
  • 13
  • 23

1 Answers1

0

I just added the preDeny parameter which allows to keep a modal opened by returning false:

Swal.fire({
  title: 'The "deny" button will not close me',
  showDenyButton: true,
  preDeny: () => {
    return false
  }
})
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script> 

Read more about preDeny: https://sweetalert2.github.io/#pre-deny

Limon Monte
  • 52,539
  • 45
  • 182
  • 213