SweetAlert - a beautiful replacement for javascript's "alert"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2015 10:50 AM
SweetAlerts2 is out.
Hi Dev's,
Last night i was working on an application that needed some input. So i used SweetAlerts on the custom UI page and it turned out really nice looking, and i thought i could use globally!.
Once you install you can do any of the tests via the console
parent.swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", closeOnConfirm: false }, function(){ swal("Deleted!", "Your imaginary file has been deleted.", "success"); });
Make sure that you use "parent.swal()"
Here's more examples listed here SweetAlert
Screenshot's below.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2018 09:07 AM
Hi Venkat,
I tried the swal alert for onsubmit function. It pops up the alert, but it stays only for few seconds and submits the form even-though 'OK' is not clicked. Do you have any idea on this?
Thanks,
Sindhu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 11:47 AM
Hello Sindhu
Sorry for delayed response. Nope I did not come across this issue, the box remains on the form unless you hit OK. Did you set any kind of timer?
Let me look at it meanwhile.
Regards!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 02:49 PM
Do you have an example of using SweetAlerts2 in a client script where you could process the result answer. The examples from SweetAlerts2 use .then((result) => {} which don't seem to work in SN.
swal({
title: 'Are you sure?',
text: "You won't be able to revert this!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.value) {
swal(
'Deleted!',
'Your file has been deleted.',
'success'
)
}
})
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2018 02:00 PM
hi. Cant seem to make your last example work. Can we see your code for the "Are you sure" option? The example in SweetAlert doesn't work because you can't use => per the example in SweetAlert, and the code you put in your post:
parent.swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", closeOnConfirm: false }, function(){ swal("Deleted!", "Your imaginary file has been deleted.", "success"); });
Does not work, nor does it match your screen shot.
Can we just see your code. That would be so helpful! Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2018 08:09 AM
That example was from the SweetAlerts2 page. I'm looking for an example of a yes,no alert with a response. It seems when you call swal, it continues with javascript execution instead of waiting for a response.
Do you have an example of where you ask a question and then process the response?
Thanks