I'm using the exactly code of SweetAlert2 examples page:
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'
)
}
})
Works fine on Firefox and Chrome, but Internet Explorer shows SCRIPT1002: Syntax Error
and not run the script...IE flag this portion as syntax error:
}).then((result) => {
Thanks for any help
(result) => {}
is an arrow function which is completely unsupported in IE. To fix this you'll have to use a traditional anonymous function:
swal({
// options...
}).then(function(result) {
if (result.value) {
swal('Deleted!', 'Your file has been deleted.', 'success');
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With