我正在使用SweetAlert盒子,我有三个按钮,我使用html输入创建,但我需要有三个不同的点击事件监听器对每个按钮点击执行不同的操作,但它不起作用.请帮忙
$('#btnProcessRequest').click(function (e) {
e.preventDefault(); //
var btn = "button";
swal({
title: "HTML <small>Consultation Review</small>!",
text: '<button type="' + btn + '" id="btnA" >A</button> ' +
'<button type="' + btn + '" id="btnB" >B</button> ' +
'<button type="' + btn + '" id="btnC" >C</button>',
html: true
}, function (idd) {
$("#btnA").click(function () {
alert(this.id);
});
$("#btnB").click(function () {
alert(this.id);
});
$("#btnC").click(function () {
alert(this.id);
});
});
});
Run Code Online (Sandbox Code Playgroud)