$("button").click(function() { swal({ title: "Red Alert!", text: "I will close in 4 seconds.", timer: 4000, showConfirmButton: false }); });