sweetalert js example
Example 1: switch alert
swal({
title: "Good job!",
text: "You clicked the button!",
icon: "success",
button: "Aww yiss!"
});
Example 2: how to use sweetalert
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
Example 3: sweetalert
swal("Hello world!");
Example 4: change icon in sweet alert
swal({ icon: "error",});
Example 5: sweetalert
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!"); }});