Introduction


This provides a great dynamic and good-looking interface and acts the same as the alert pop up. Let us have a look at the difference once. The old alert is shown above and rather should be an imprint in any developer's mind. Now below is the alert by Sweet Alert, which is truly sweet. Doesn't this look professional and goes with the websites being designed now?

- swal("Welcome to SWAL");
Now let us get into the other secrets of SWAL and `beautify!
We can do a lot many interesting things using this simple tool. Let's check out.
More facts and Secrets of SWAL

- swal("Welcome to SWAL","Is'nt this pretty!!");
We can add icons to update user with more information and in a more interactive manner. Let's check how! This is a success message like we can have supposed success message alert for Addition of Detail is Success or Update or Delete is a success.

- swal("Welcome to SWAL","Is'nt this pretty!!","success");

- swal("Welcome to SWAL","Oh no!!","error");

The code looks like the following:
- swal("Welcome to SWAL","Are you sure!!","warning");
- swal({
- title: "Are you sure?",
- text: "You are deleting this completely!",
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "Yes, delete it!",
- closeOnConfirm: false
- },
- function(isConfirm)
- {
- if (isConfirm)
- {
- swal("Deleted!", "Your file has been deleted.", "success");
- }
- });
The above snippet is only a confirmation and if confirmed then what to do. Here a success alert is displayed that file is deleted. We can also format the text in HTML format, display any image or any other sort of html manipulation inside the alert pop up. Check below:
- swal(
- {
- title: "HTML Welcome to SWAL!",
- text: "A html format html message.",
- html: true
- });
SWAL required only a CSS and JavaScript file to be added to your layout and done. The following is the direct download link to get the files,

Pradeep SahooPosted Mar 18, 2016, 8:48 PM
its nice info....
Santhakumar MunuswamyPosted Jan 5, 2016, 11:31 PM
Thanks for nice article
Muhammad Aqib ShehzadPosted Jan 5, 2016, 7:40 AM
Good Share
Suraj SahooPosted Jan 4, 2016, 7:12 AM
Thanks Ankit hope you use and take the feel..:)
Ankit BansalPosted Jan 4, 2016, 6:22 AM
Nice one..
Anupam SinghPosted Jan 3, 2016, 11:30 PM
cool.
Sridhar SharmaPosted Jan 3, 2016, 10:26 PM
That's just nice :)