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%'
})
});
});
});