Bootbox.js – alert, confirm and flexible dialogs for twitter’s bootstrap framework

I’ve been using twitter’s bootstrap framework for a number of site builds recently, mainly because it gets me from black-and-white markup to vaguely-presentable websites in a very small amount of time. Version 1.3 introduced some JavaScript plugins to complement the array of stylistic elements it already provided – notably code to invoke dialog boxes, or modals. A recent project I’ve been working on required extensive use of JavaScript’s native alert and confirm dialogs, but their crude behaviour and wildly varying appearance between browsers is always somewhat dissatisfying, so I wanted combine their basic functionality with bootstrap’s slick looking dialog boxes. Enter bootbox.js – alert() and confirm() like behaviour using twitter’s modal dialog boxes.

Dialogs using Twitter Bootstrap

You may be wondering why a few wrapper methods around bootstrap’s built-in dialog capabilities are either necessary or desirable. To begin to answer that, let’s look at the code required to show a simple alert style dialog programatically using bootstrap:


cdl_capture_2012-01-03-22_ 000





Leave a comment