javascript - 将按钮添加到 $.dialog (jquery-confirm.js)
问题描述
我目前正在使用 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!');
},
解决方案
推荐阅读
- python - 使用命名空间创建 XML 文档
- xml - Oracle Sql 查询(XML 列)
- docker - 使用 docker ubuntu 服务器访问文件共享的正确方法
- amazon-web-services - 有没有办法指定任务放置策略,以便将新任务放置在具有最多可用内存的实例上?
- php - 超链接会打开一个新选项卡,该选项卡会在预期页面出现后立即关闭
- javascript - 拼命想弄清楚如何在 HTML 网站上显示 API 信息
- c++ - 触发c ++回调函数时如何更新swift变量
- gitlab-api - GitLab API - 搜索项目
- c - 交叉编译 libwebsockets 时,字段“ctx”有不完整的类型错误
- json - 通过 Logstash 将 JSON 从 CouchDB 解析到 ElasticSearch