cara melampirkan fungsi ke tombol sweetalert2
<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