sweetalert documentation code 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: sweet alert

<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>

Example 4: sweetalert

swal("Error!", "You clicked the button!", "error");

Example 5: change icon in sweet alert

swal({  icon: "error",});

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 () { /*Your Code Here*/ },
       function () { return false; });