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:

935 questions
63
votes
11 answers

sweet-alert display HTML code in text

I am using sweet-alert plugin to display an alert. With a classical config (defaults), everything goes OK. But when I want to add a HTML tag into the TEXT, it display ... without making it bold. After searching for the answer, it looks like I…
Peter
  • 1,380
  • 2
  • 19
  • 25
43
votes
1 answer

Cannot flush updates when React is already rendering

I'm trying to show an alert when the API returns an error. For the alert window I'm using sweetalert2. In my render method I'm checking if the error message contains content. If it contains an error message I want to show the user an alert. When I…
J. Adam
  • 737
  • 1
  • 10
  • 25
32
votes
10 answers

Remove "OK" button from sweet alert dialog

I am using javascript sweetalert2 library. I want to remove the OK button from the alert box but I did not find any property for not to display this button. I am using the timer property timer:1000 for closing the alert in one second. So, I don't…
Ankush Rishi
  • 2,362
  • 7
  • 21
  • 53
29
votes
13 answers

Prevent SweetAlert to be closed on clicking outside the popup window

I am using Sweet Alert for a popup on my product view in an E-commerce Application with two buttons: one for going on cart View and another for reloading the view. But when a user clicks outside of the popup, the popup window closes…
Saqib A. Azhar
  • 804
  • 1
  • 13
  • 24
27
votes
11 answers

SweetAlert - Change Modal Width?

I love this library. I'd like to use it to display a moderate response table on one of my web pages, but the text gets a little wide. I was hoping there was an option to change the width of the overall alert for the page that I'm displaying the…
Watercayman
  • 6,940
  • 10
  • 27
  • 42
26
votes
12 answers

How to redirect page after click on Ok button on sweet alert?

I am able to display sweet alert after the page refresh but I have to click on Ok button which I am getting on sweet alert to redirect the page.Please help me in this. '; echo 'setTimeout(function…
user6930268
20
votes
5 answers

Uncaught (in promise) cancel using SweetAlert2

how do I properly escape the cancel button without throwing an error when using promises? My code throws an alert confirmation with a required checkbox. the code executes as it should to the user, but it throws an error in the console…
Frankenmint
  • 1,304
  • 1
  • 15
  • 29
18
votes
6 answers

how to close sweet alert on ajax request completion

I am using Sweet-alert in my angular app. function GetDataFromServer(url) { SweetAlert.swal( { title: "", text: "Please wait.", imageUrl: "../../app/app-img/loading_spinner.gif", showConfirmButton: false …
Kgn-web
  • 5,443
  • 13
  • 63
  • 119
18
votes
11 answers

SweetAlert - Change Color of Button

I'm trying to change the color of the cancel button like I can for the confirm button but it doesn't seem to work for some reason. swal({ title: "Are you sure?", text: "You will not be able to recover this imaginary file!", type:…
compcobalt
  • 1,132
  • 5
  • 29
  • 59
18
votes
6 answers

How to use sweetalert2 in angular2

Getting this error after npm start in angular project. app/app.component.ts(12,7): error TS2304: Cannot find name 'swal'. app/app.component.ts(21,7): error TS2304: Cannot find name 'swal'. I created an angular project. Inside app.component.ts I…
Akash Rao
  • 890
  • 3
  • 12
  • 23
17
votes
8 answers

More than 2 buttons on sweetalert 2

I have a sweetalert with 2 buttons but I want to have one more button in it. For example, as of now, I have yes and no I want to add one more button say later. Please help. $("#close_account").on("click", function(e) { e.preventDefault(); …
Sukhwinder Sodhi
  • 397
  • 1
  • 3
  • 15
16
votes
14 answers

SweetAlert prompt with two input fields

Currently working on a personal project. I want the user to click a button and a SweetAlert prompt would be presented for the user to verify their credential. However, the code I see on the SweetAlert website only allows one input field. Here is the…
ballerz
  • 367
  • 2
  • 4
  • 14
15
votes
4 answers

How to change sweetalert button text?

I want to change the 'Ok' button with 'Select patient' and the 'Cancel' to 'Speed case'. How can I do that? swal({ text: "Start new case by", buttons: true, confirmButtonText: "Select Patient?", cancelButtonText: "Speed Case?", });
Dip Girase
  • 319
  • 1
  • 5
  • 18
15
votes
11 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
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
  • 361
  • 1
  • 14
1
2 3
62 63