Developer Snippet Diary

Sweet alerts tutorial in js, css

Sweets alert tutorial

1. Add cdn

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

2.  After importing the files into your application, you can call the swal function (make sure it's called after the DOM has loaded!)

document.addEventListener("DOMContentLoaded", function(){
    	swal("Hello world!");

    	/* If you pass two arguments, the first one will be the modal's title, and the second one its text. */
    	swal("Here's the title!", "...and here's the text!");

    	/* with a third argument, you can add an icon to your alert! There are 4 predefined ones */
    	swal("Good job!", "You clicked the button!", "success");

    	/* with options */
    	swal({
    	    	title: "Good job!",
    	    	text: "You clicked the button!",
    	    	 icon: "success",
    	    	 button: "Aww yiss!",
    	 });
});

for more visit:
https://sweetalert.js.org/guides/

Posted by: R GONDAL
Email: rizikmw@gmail.com