So fügen Sie die Funktion an Taste SweetAlert2 an

<button onclick="successModal()"id="myButton">Click Here</button>

function successModal() {
    const Toast = Swal.mixin({
      toast: true,
      position: 'top-end',
      showConfirmButton: false,
      timer: 3000,
      timerProgressBar: true,
      didOpen: (toast) => {
        toast.addEventListener('mouseenter', Swal.stopTimer)
        toast.addEventListener('mouseleave', Swal.resumeTimer)
      }
    })

    Toast.fire({
      icon: 'success',
      title: 'Connected Successfully'
    })
}
Anthony Smith