sweet alert.js code example
Example 1: Sweetalert
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script>swal("My title", "My description", "success");</script>
Example 2: sweet alert
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
Example 3: sweet alerts mdn
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></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,
}
}
});
Example 5: swal change confirm button class
Swal.fire({
title: 'example text',
buttonsStyling: false,
customClass: {
confirmButton: 'example-class'
}
})
Example 6: sweet alert
swal("Good job!", "You clicked the button!", "error");