更改默认启动箱确认模式按钮

时间:2018-07-30 12:33:13

标签: javascript bootbox

我有以下启动箱确认模式:

bootbox.confirm(
"some inputs that I append to modal",
function (result) {
    if (result) {
        code...
    }
});

如何将默认按钮更改为以下代码?

1 个答案:

答案 0 :(得分:1)

尝试签出documentation of bootbox.js

它们甚至包括an example,用于在确认对话框中修改默认按钮:

bootbox.confirm({
    message: "This is a confirm with custom button text and color! Do you like it?",
    buttons: {
        confirm: {
            label: 'Yes',
            className: 'btn-success'
        },
        cancel: {
            label: 'No',
            className: 'btn-danger'
        }
    },
    callback: function (result) {
        console.log('This was logged in the callback: ' + result);
    }
});