sweetalert2 custom css code example
Example 1: sweet alert 2 do action on confirm
Swal.fire({
title: 'Do you want to save the changes?',
showDenyButton: true, showCancelButton: true,
confirmButtonText: `Save`,
denyButtonText: `Don't save`,
}).then((result) => {
if (result.isConfirmed) {
Swal.fire('Saved!', '', 'success')
} else if (result.isDenied) {
Swal.fire('Changes are not saved', '', 'info')
}
});
Example 2: sweet alert
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
Example 3: sweetalert2
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
Example 4: sweet alert js
swal({
title: "Deleted!",
text: "Your row has been deleted.",
button: "Close",
icon: "success",
timer: 3000,
buttons: {
confirm: {
text: "OK",
value: true,
visible: true,
className: "",
closeModal: true
},
cancel: {
text: "Cancel",
value: false,
visible: true,
className: "",
closeModal: true,
}
}
});