1
我有一個甜蜜的警報,有多個按鈕。當用戶點擊一個按鈕時,應該打開一個不同的警報。我能夠得到1個按鈕來工作,但就是這樣。 Sweet Alert 2有可能嗎?甜蜜警報2 - 有多個按鈕打開不同的警報
代碼:
$("#swa").on("click", function(e) {
swal({
title: '<u><b>Test 1</b></u><p> </p>',
html:
'<button id="panel2">Panel 2</button>'+
'<p> </p>'+
'<button id="panel3">Panel 3</button>',
showCloseButton: true,
showCancelButton: true,
cancelButtonText: 'Go Back',
width: '75%'
})
$("#panel2").on("click", function(e) {
swal({
title: '<u><b>Test 2</b></u><p> </p>',
html:
'Test 2',
showCloseButton: true,
showCancelButton: true,
cancelButtonText: 'Go Back',
width: '75%'
})
$("#panel3").on("click", function(e) {
swal({
title: '<u><b>Test 3</b></u><p> </p>',
html:
'Test 3',
showCloseButton: true,
showCancelButton: true,
cancelButtonText: 'Go Back',
width: '75%'
})
});
});
});