jquery – Bootbox确认对话框问题

不幸的是,文件BootBox( http://paynedigital.com/2011/11/bootbox-js-alert-confirm-dialogs-for-twitter-bootstrap)没有教如何调用确认对话框.因为它是在文档窗口总是出现在页面加载时,什么是错误的,应该出现当通过点击删除按钮调用.
这是尝试失败的代码.
// show "false" does not work,the confirm window is showing when page is loaded.
$(function () {
bootBox.confirm("Confirm delete?","No","Yes",function(result) {
show: false
});     
});

// need show the confirm window when the user click in a button,how to call the confirm window?

<td><a class="icon-trash" onclick="bootBox.confirm();" href="{% url 'del_setor' setor.id %}" title="Delete"></a></td>

仅当点击删除按钮时,如何将此引导框设置为仅显示
谢谢!

编辑 – 解决

$(function () {
$("a#confirm").click(function(e) {
    e.preventDefault();
    var location = $(this).attr('href');
    bootBox.confirm("Confirm exclusion?",function(confirmed) {
        if(confirmed) {
        window.location.replace(location);
        }
    });
});     
});

现在,当我点击“是”时,删除工作.
我问这个插件的开发人员将完整的示例放在文档中,所以用户不需要在点击“是”时创建关于如何删除对象的帖子.
问候.

解决方法

您可能需要在本页“基本使用”上的“确认”链接上查看源: http://bootboxjs.com/

这是一个片段:

$("a.confirm").click(function(e) {
    e.preventDefault();
    bootBox.confirm("Are you sure?",function(confirmed) {
        console.log("Confirmed: "+confirmed);
    });
});

假设jQuery在您正在使用的UI中可用,我将避免在您的锚标签中使用onClick属性.只是我的两美分.

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...