我目前正在使用jquery-confirm.js进行警报,确认和对话框。
https://craftpip.github.io/jquery-confirm/
问题是我无法使按钮适应对话框,我不确定这是插件还是我对JS的了解不足。
例如,我有这个对话框:
setTimeout(function () {
$.dialog({
title: 'Existing user',
content: "This account is already registered on our system. If you are the real owner, contact us!",
icon: 'fas fa-user',
theme: 'modern',
animation: 'scale',
type: 'red',
draggable: false,
closeIcon: function () {
setTimeout(function () {
window.location="/dashboard";
}, 250);
}
});
}, 200);
唯一的按钮是closeIcon。如果我想对他补充一下该怎么办?我的意思是buttons
。
$.confirm({
title: 'Confirmation',
content: 'Are you sure do you want to delete <strong>'+ig_name+'</strong>? We will delete all the information, however you will be able to add it again whenever you want.',
icon: 'fa fa-user-times',
animation: 'scale',
closeAnimation: 'scale',
opacity: 0.5,
draggable: false,
escapeKey: 'cancel',
buttons: {
'confirm': {
text: 'Delete',
btnClass: 'btn-blue',
action: function () {
document.getElementById('DeleteAccountForm1').submit();
}
},
cancel: {
text : 'Cancel',
},
}
});
});
编辑:
我尝试过这个,但是没有显示$ .dialog。
buttons: {
confirm: function () {
$.alert('Confirmed!');
},
cancel: function () {
$.alert('Canceled!');
},