Example 1: sweet alert
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
Example 2: 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,
}
}
});
Example 3: sweet alert
swal("Good job!", "You clicked the button!", "success");
Example 4: sweet alert
swal("Good job!", "You clicked the button!", "error");
Example 5: sweetalert confirm box
swal({ title: "Are you sure?", text: "Once deleted, you will not be able to recover this imaginary file!", icon: "warning", buttons: true, dangerMode: true,}).then((willDelete) => { if (willDelete) { swal("Poof! Your imaginary file has been deleted!", { icon: "success", }); } else { swal("Your imaginary file is safe!"); }});
Example 6: confirm sweet alert
swal("Are you sure?", { dangerMode: true, buttons: true,});