Q:

sweet alert 2 do action on confirm

swal({
  title: "Are you sure?",
  text: "Your will not be able to recover this imaginary file!",
  type: "danger",
  showCancelButton: true,
  confirmButtonClass: "btn-danger",
  confirmButtonText: "Yes, delete it!",
  closeOnConfirm: false
},
function(){
  swal("Deleted!", "Your imaginary file has been deleted.", "success");
});
3
Swal.fire({  
  title: 'Do you want to save the changes?',  
  showDenyButton: true,  showCancelButton: true,  
  confirmButtonText: `Save`,  
  denyButtonText: `Don't save`,
}).then((result) => {  
	/* Read more about isConfirmed, isDenied below */  
    if (result.isConfirmed) {    
    	Swal.fire('Saved!', '', 'success')  
    } else if (result.isDenied) {    
    	Swal.fire('Changes are not saved', '', 'info')  
 	}
});
0
Swal.fire({  title: 'Are you sure?',  text: 'You will not be able to recover this imaginary file!',  icon: 'warning',  showCancelButton: true,  confirmButtonText: 'Yes, delete it!',  cancelButtonText: 'No, keep it'}).then((result) => {  if (result.value) {    Swal.fire(      'Deleted!',      'Your imaginary file has been deleted.',      'success'    )  // For more information about handling dismissals please visit  // https://sweetalert2.github.io/#handling-dismissals  } else if (result.dismiss === Swal.DismissReason.cancel) {    Swal.fire(      'Cancelled',      'Your imaginary file is safe :)',      'error'    )  }})
0

New to Communities?

Join the community