ZENIT
ZENIT

Reputation: 510

SweetAlert2 Examples Won't Work in IE11

SweetAlert2 examples do not work with IE11.

The following code won't run with IE11:

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'
     )
   }
})

Upvotes: 1

Views: 1834

Answers (1)

ZENIT
ZENIT

Reputation: 510

SweetAlert2 examples use Arrow functions and other ES6 goodies that IE11 cannot handle.
The simple way to overcome this problem is to use function() syntax instead () =>

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(function(result) {
   if (result.value) {
     swal(
       'Deleted!',
       'Your file has been deleted.',
       'success'
     )
   }
})

Upvotes: 4

Related Questions