swal function code example

Example 1: swal({

swal("Here's a message!", "It's pretty, isn't it?")

Example 2: confirm sweet alert

swal("Are you sure?", {  dangerMode: true,  buttons: true,});

Example 3: 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; });

Tags:

Misc Example