Compare that to the code you’d have to write without Bootbox:
The only required argument is for alert calls is message; callback is required for confirm and prompt calls in order to determine what the user’s response was. Even when calling alert a callback is useful to determine when the user dismissed the dialog since our wrapper methods can’t & don’t block like their native counterparts: they are asynchronous rather than synchronous.
Each of these three methods calls a fourth public method which you too can use to create your own custom dialogs:
Please note: the ‘Example’ object used in the following examples simply displays a notification to help illustrate when each callback is invoked. It is nothing to do with Bootbox itself, but you may view its source if you’re interested in how it works.
The latest stable version of Bootbox is 4.3.0. You can download the minified library bootbox.min.js for use in production, or the uncompressed bootbox.js for use in development. I wouldn’t recommend hotlinking to either file as Github does not serve the correct mime type which may cause security warnings to be triggered based on your browser’s settings.
If you wish you may also see a full list of releases or download the latest copy of the entire repository (including build files and tests) in zip or tarball format. Realistically the only reason you should be using anything other than the 4.x.x series is if you are restricted by the version of Bootstrap you’re using—see the following section for full details.
All versions of Bootbox stand on the shoulders of two great giants: Bootstrap and jQuery. The exact version of Bootstrap depends on the version of Bootbox you’re using. This has become slightly more complex than I’d like but hopefully this handy table will clear things up (if it doesn’t then please tell me!):
|Bootbox version||Min. Bootstrap version||Max. Bootstrap||Min. jQuery||Notes|
|4.x.x Latest||3.0.0||3.0.0||1.8.3||Current release. Entirely rewritten to support Bootstrap 3.0.0|
|3.x.x||2.2.2||2.3.2||1.8.3||Last version to support Bootstrap 2|
|2.x.x||2.0.0||2.0.4||1.7.1||As you can see, Bootstrap 2.1.x was never officially supported|
|1.x.x||1.3.0||1.4.0||1.7.1||Don’t download this version of Bootbox—it’s old|
Lastly—please just help spread the word!