單擊 SweetAlert2 的確認按鈕后,我想打開一個模式。但是點擊后什么也沒有發生。
我找到了唯一一個,這與我現在遇到的問題相同。
我也嘗試過,但它不起作用,可能是因為他擁有最舊版本的 SweetAlert。
無論如何,這是我的代碼:
Swal.fire({
title: 'Process Selected Item(s)?',
icon: 'warning',
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'YES!',
cancelButtonText: 'No, cancel!',
reverseButtons: true,
allowOutsideClick: false
}).then((result) => {
if (result.isConfirmed) {
$('#processItemsModal').modal('show');
} else{
Swal.fire(
'Cancelled',
'No changes has been made!',
'error'
)
}
})
你認為我在這里缺少什么?
TIA
uj5u.com熱心網友回復:
解決了我的問題,因為我使用的是 Bootstrap v5。
而不是這個;
$('#processItemsModal').modal('show');
我用過這個;
let myModal = new bootstrap.Modal(document.getElementById('processItemsModal'), {});
myModal.show();
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/445227.html
上一篇:選擇具有特定類的上一個兄弟姐妹
