Questions tagged [sweetalert]

SweetAlert is a JavaScript library that provides a replacement for standard alert() dialogue.

SweetAlert is a JavaScript library that provides a replacement for the standard alert() dialogue that allows styling and customization. Indeed, it also may be regarded as a replacement for confirm() and prompt().


Documentation :

Similar Libraries:

1069 questions
17
votes
13 answers

sweet alert continue submitting form on confirm

I've this sweetalert triggered on submit of a form. $(".swa-confirm").on("submit", function(e) { e.preventDefault(); swal({ title: $(this).data("swa-title"), text: $(this).data("swa-text"), type:…
user796443
16
votes
3 answers

How to listen for when sweet alert closes

I am currently working with sweetalert2 and I am trying to detect when the alert closes. However the DeleteUnsavedImages function is not firing. I thought that assigning the function to the onclose key would work but no luck. swal({ html:…
Hayden Passmore
  • 1,135
  • 2
  • 12
  • 34
16
votes
5 answers

Sweet alert timer - done function

I have been playing a little with the SweetAlert plugin: Sweet alert I wanted to make a delete button, where the user gets prompted before the actual delete. When the user then presses "delete" again, is then says "done" and the user has to click…
Teilmann
  • 2,146
  • 7
  • 28
  • 57
13
votes
9 answers

how to load java script variable in to the bootstrap model text box as value

I have some issue in javascript variable load in to the bootstrap model input box: setTimeout(function() { swal({ title: "OverTime Status!", text: "You Need to get Sub OT Approval " + data.value + " Hours to Time allocate in the…
Code Kris
  • 447
  • 3
  • 19
13
votes
3 answers

Adding class to sweet alert

I am trying to add an extra class for my modal so I can select it from LESS and turn it's background to transparent. But customClass is not working. Is there any other way to do it. BTW I have already changed a lot with default classes so I need to…
nodeSpret
  • 49
  • 1
  • 1
  • 6
13
votes
4 answers

Convert javascript array to object of same keys/values

I have a function that returns an array, as follows: But I'm trying to populate a SweetAlert2 dialog. As the documentation exemplifies, the desired input would look like this inputOptions: { 'SRB': 'Serbia', 'UKR': 'Ukraine', 'HRV':…
Phiter
  • 14,570
  • 14
  • 50
  • 84
12
votes
1 answer

Uncaught SweetAlert: Unexpected 2nd argument?

I have a problem with sweetalert, I would like to show the confirm box alert on button click but it's not working This is my JS code: $(document).ready(function(){ $('[data-confirm]').on('click', function(e){ e.preventDefault(); //cancel…
12
votes
2 answers

SweetAlert Calling code after clicking "Cancel" button

I have written following code, I want to call a code under "Cancel" button: vm.saveGroup = function(){ SweetAlert.swal({ title: "Name this Device Group", text: "Please provide a name that you want your device group to be saved…
Tomasz Waszczyk
  • 2,680
  • 5
  • 35
  • 73
12
votes
8 answers

SweetAlert2 - Bind another event to cancel button?

I am using the latest version of the awesome SweetAlert2 jquery plugin. I have a simple SweetAlert with 2 buttons. 1 button is the confirm button, the other is the cancel button. I am using the html option to add a text input to the alert. When the…
Piet
  • 2,188
  • 5
  • 19
  • 30
11
votes
3 answers

ReferenceError: "Swal is not defined"

I'm working on small project using codeigniter and VueJs and sweet alert javascript library. but i get an error in my console ReferenceError: "Swal is not defined" once i call swall.fire({}) inside my VueJs methods. This is my code :…
Amine Bouhaddi
  • 554
  • 1
  • 7
  • 24
11
votes
11 answers

How to reload a page after clicked ok using sweetalert

Hello I have a code using sweetalert swal("Good job!", "You clicked the button!", "success") this code will pop-up a message and has a button okay, what I like to do is I want to refresh the page after I click the okay button. Can I do that?
Fil
  • 8,225
  • 14
  • 59
  • 85
10
votes
4 answers

how to change font family of sweetalert

How can I change the font family in sweetalert? Thank You swal({ title: "Are you sure?", text: "Your will not be able to recover this imaginary file!", type: "warning", showCancelButton: true, …
farshid azizi
  • 364
  • 1
  • 5
  • 18
10
votes
1 answer

Uncaught TypeError: Cannot read property 'then' of undefined using Sweet Alert

I am using SweetAlert2 and I am getting the following error Uncaught TypeError: Cannot read property 'then' of undefined When I use the exact same code as suggested in SweetAlert page. swal({ title: 'Are you sure?', text: "You won't be able to…
marimaf
  • 5,382
  • 3
  • 50
  • 68
10
votes
4 answers

Page is not waiting for response from SweetAlert confirmation window

I am trying to upgrade my JavaScript confirm() action to use SweetAlert. Currently my code is something like this: Delete This waits for the user to confirm before…
dmeehan
  • 2,317
  • 2
  • 26
  • 31
9
votes
4 answers

How to have sweetalert return true/false for confirm without promise?

I like the simplicity of javascript confirm so that I can do this: if(!confirm("are you sure?")) return; in sweetalert you have to nest your true code within a then promise function. Is there a way to have sweetalert return true/false the same…
boruchsiper
  • 2,016
  • 9
  • 29
  • 53
1
2
3
71 72