1

I'm using Laravel 5.8 and Sweetalert v2 and I tried firing this alert with it at the Blade:

Swal.fire({
    title: '<h4 style="color: #0c5460;">Updating user status</h4>',
    html: '<h5 style="color: #0c5460">Wait...</h5>',
    width: 400,
    padding: '1em',
    background: '#fff url(/images/cream_pixels.png)',
    timer: 1000,
    onBeforeOpen: () => {
        Swal.showLoading()
    },
});

And it popups properly but does not show the loader and shows me this error at the Console:

SweetAlert2: Unknown parameter "onBeforeOpen"

So what's going wrong here?

3
  • @KenLee Can you explain more about what you say Commented Jul 4, 2022 at 5:35
  • @KenLee I have used onBeforeOpen () { Swal.showLoading() }, instead and shows me the same error !! Commented Jul 4, 2022 at 6:12
  • @KenLee "realrashid/sweet-alert": "^5.1" Commented Jul 4, 2022 at 6:19

1 Answer 1

4

Use didOpen: Asynchronously runs after the popup has been shown on screen. Provides popup DOM element as the argument

              Swal.fire({
                didOpen: () => {
                  Swal.showLoading();
                }
              })
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.