adding function to sweet alert button code example
Example 1: swalert 2 show loader
Swal.fire({
title: 'Please Wait !',
html: 'data uploading',// add html attribute if you want or remove
allowOutsideClick: false,
onBeforeOpen: () => {
Swal.showLoading()
},
});
Example 2: sweet alert js
swal({
title: "Deleted!",
text: "Your row has been deleted.",
button: "Close", // Text on button
icon: "success", //built in icons: success, warning, error, info
timer: 3000, //timeOut for auto-close
buttons: {
confirm: {
text: "OK",
value: true,
visible: true,
className: "",
closeModal: true
},
cancel: {
text: "Cancel",
value: false,
visible: true,
className: "",
closeModal: true,
}
}
});
Example 3: swal change confirm button class
Swal.fire({
title: 'example text',
buttonsStyling: false,
customClass: {
confirmButton: 'example-class' //insert class here
}
})