sweetalert - Generic function in jquery whit sweet alert 2 and replace confirm

I need create a generic function similar the confirm function in jquery using sweet alert 2.var eval = ConfirmModalDelete("mensaje text"); alert(eval);The problem is when call the function "ConfirmModalDelete" jquery not wait for result of "swal".function ConfirmModalDelete(mensaje) {var retorno = false;swal({ title: 'Are you sure?', text: mensaje, type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, delete it!'}).then(function (result) { if (r...Read more

sweetalert2 - Sweetalert now showing values and two buttons for prompts

I am trying to customize the swal prompt code. What I am trying to do is get the value from input then send it to the server for processing. After I click the Update Button nothing happens! I am not able to understand why is it happening so. Also, I am trying to implement the cancel button in it but it doesn't seem to work either, look like it only accept one button there.Following is my code.$(".edit").click(function(event) { var id = $(this).data("id"); var $this = $(this); var value = $(this).closest('...Read more

sweetalert - SweetAlert2 Cancel button not working properly

I have a Yes and No button in my SweetAlert2. When I click on No it does a post to a method but I just want it to close the SweetAlert. Here is the code I have written: $('.js-update-details-click').click(function () { var Id = Number($(this).data('result-id')); swal({ title: 'Are you sure you want to ask the User to update their details?', type: 'warning', showCancelButton: true, closeOnConfirm: false, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', ...Read more

sweetalert - Sweet alert closing on spacebar press.

I have a sweet alert with a textarea on it, the window is closing on spacebar press. swal({ title: 'Something Went Wrong', text: '<textarea id="my-textarea" name="my-textarea" rows="5" />', type: 'error', showCancelButton: true, confirmButtonText: 'Yes, Refresh Page', confirmButtonClass: 'btn-danger', html: true }Can I prevent this behaviour ?...Read more

sweetalert - missing select options with Sweet Alert

This may be a ServiceNow issue, but I added a Sweet Alert to show a select box just so I can gather a value to pass on to the next record... but the select box is not showing, the popup is there just no box or options. What am I missing? Screenshot:Select Box AlertThanks so much, super frustrated with something I thought would be simple to add :)swal({ title: 'Select Outage Tier', input: 'select', inputOptions: { '1': 'Tier 1', '2': 'Tier 2', '3': 'Tier 3' }, inputPlaceholder: 'required', showCancelButton: true, inputValidator...Read more

sweetalert2 - how to fetch the input value entered using sweetalert?

using attribute ' type: "input" ', i am able enter value in textbox. I need to know how to fetch the input value .Below is my code :input:"text" is not working ...I tried fetching value using json.parse ...nothing is working. Please help me to fetch and store the valueswal({ title: "Your order summary is ***", text: "Proceed to checkout", //type: "success", type: "input", showCancelButton: true, confirmButtonColor: "#EF5350", ...Read more

sweetalert - Pass HTML code as text of sweet alert

I am using this in my application. I would like to use sweet alert like below.swal({ title: "Are you sure?", text: "You are going to delete <b>"+ name +"</b> address. ", icon: "warning", buttons: true, dangerMode: true, })But it now working. It is displaying HTML code. Thanks.UpdateI read this question, but this question is about sweet alert2. My question is about sweet alert . Both are sweet alert but both are not same....Read more

SweetAlert confirmar eliminar

Actualmente estoy trabajando este codigo de un ejemplo de tabla de busqueda, eliminacion y edicion de campos, quiero utilizar Sweetalert para hacer más vistosas las alertas de javascript y aunque he logrado que se visualicen en mi codigo javascript no logro que elimine el campo, ahora si utilizo la función confirmDel elimina sin ningun problea.¿De que manera debe quedar el codigo javascript para que el sweet alert elimine?var script = document.createElement('script'); script.src = "https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/6...Read more

sweetalert - una alerta de sweetalert2 no funciona

Lo siguiente es mi código para intentar eliminar un registro de una base de datos y que una vez eliminado me muestre la alerta de que ha sido eliminado. Sucede que me muestra la alerta diciéndome que un registro eliminado no se puede recuperar, si le doy en cancelar me enseña la alerta de que mi registro está seguro; pero sí le digo eliminar no me muestra ninguna alerta, sin embargo sí que elimina el registro de la base de datos. Se comporta como si ni llegara al if, es decir, ni entra al if ni hace la alerta del else de ese if, o sea, no llega...Read more

sweetalert2 - How to properly catch errors in SweetAlert

I have the following swal code and it works fine if the returned status for the HTTP call is '200'. But if I get a '403' unauthorized error the swal loader keeps spinning and the message never goes away, like shown below. I'm not sure if I'm not handling the error correctly. Can you help?let that = this;swal({ title: 'Are you sure?', text: 'You won\'t be able to revert this!', type: 'warning', showCancelButton: true, confirmButtonText: 'Yes, delete it!', confirmButtonColor: '#d33', cancelButtonText: 'No, keep it', showLoaderOnConfirm: t...Read more

sweetalert - Sweet Alert works in local but Doesn't work in server

That function works in local host(I am using Laragon) but in the host(Natro) doesn't work. I didn't understandt how is it possible. $.ajax({ url:"netting/process.php", type:"POST", data:new FormData(this), contentType:false, cache:false, processData:false, success:function(data){ veri=JSON.parse(data); if (veri.status=="success") { swal(veri.head,veri.message,veri.status); } else{ swal(veri.head,veri.message,veri.status); } } });...Read more

sweetalert - On load Set value for sweet alert input

In sweet alert 2, How on load to set value in input my sweet alert codeswal({ title: 'Are you sure?', text: "You are going to send emails from the system. Please confirm", showCancelButton: true, input: 'email', confirmButtonText: 'Submit', confirmButtonColor: '#4aa0f1', cancelButtonColor: '#898b8e', confirmButtonText: 'Send' }).then(function (email) { send_email = email; sentHtmtB...Read more

sweetalert 2 target a div rather than entire window?

Is it possible to target a div rather than the entire window for SweetAlert2?If not is is possible to edit the center coordinates?The reason I ask is that I have a few JavaScript games that i would like to use this framework with. these are loaded in <div>'s which are not centered on the page. The sweet alert popup looks strange when it opens as it is miss-aligned.This is fine for mobile games but not for browser based.Any help would be great :)...Read more