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:
DEMO
http://makeusabrew.github.com/bootbox/demo/
Download
http://paynedigital.com/2011/11/bootbox-js-alert-confirm-dialogs-for-twitter-bootstrap