I played a little with the SweetAlert: Sweet alert plugin
I wanted to make a delete button where the user will be prompted before the actual removal. When the user clicks “delete” again, he says “done,” and the user must click “OK” again so that the invitation disappears forever.
SweetAlert has a timer function, so you can automatically close the last Done prompt in a few seconds, which works great. They also have a function where you can implement a function that will run when the user clicks OK at the Finish prompt. The problem is that this function does not start if the prompt automatically closes after the timer ends.
Any ideas how to do this?
If the timer and function are not running:
swal({
title: "Deleted!",
text: "Your row has been deleted.",
type: "success",
timer: 3000
},
function () {
location.reload(true);
tr.hide();
});
Without a timer, but with a working function (when you click "OK"):
swal("Deleted!", "Your row has been deleted.", "success"), function () {
location.reload();
tr.hide();
};
source
share