Skip to content

Instantly share code, notes, and snippets.

@makeusabrew
Created November 6, 2011 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makeusabrew/1343224 to your computer and use it in GitHub Desktop.
Save makeusabrew/1343224 to your computer and use it in GitHub Desktop.
bootbox.js - confirm with custom labels
bootbox.confirm("Are you sure?", "No way!", "Yes, definitely!", function(result) {
console.log("Confirmed? "+result);
});
@devniz
Copy link

devniz commented Nov 24, 2014

Can you explain why this custom confirm dialog always launch this error: Uncaught Error: Invalid argument length.

@subhash8108
Copy link

same getting the issue

@RandomlyOnside
Copy link

RandomlyOnside commented Sep 18, 2017

i believe this is due to an update to bootbox.... i was having the same issue and tried the code below and got it working.

bootbox.confirm({
            title: "danger - danger - danger",
            message: "Your custom message here",
            buttons: {
                cancel: {
                    label: "Cancel or something",
                    className: "btn-default pull-left"
                },
                confirm: {
                    label: "Delete or something",
                    className: "btn-danger pull-right"
                }
            },
            callback: function(result) {
                if (result) {
                    alert("confirm ok");
                } else {
                    alert("confirm cancel");
                }
            }
        });

credit to bootboxjs/bootbox#256 and
http://plnkr.co/edit/iTvCwyDxPods1FCtPBJc?p=preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment