sweetalert cdn code example
Example 1: sweet alert cdn
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
Example 2: sweet alert cdn
swal("Good job!", "You clicked the button!", "success");
Example 3: switch alert
swal({
title: "Good job!",
text: "You clicked the button!",
icon: "success",
button: "Aww yiss!"
});
Example 4: 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 5: sweet alert bootstrap
Swal.fire( 'Good job!', 'You clicked the button!', 'success')
Example 6: swal confirm
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: '#DD6B55',
confirmButtonText: 'Yes, I am sure!',
cancelButtonText: "No, cancel it!"
}).then(
function () { },
function () { return false; });