Getting Started

Bootbox.js is designed to make using Bootstrap modals easier! Follow the guide below, and you should be up and running in no time.

Bootbox can be added to your project in two easy ways:

Via npm

Run the following command to add Bootbox to your project:

npm install bootbox

Direct download

If you're not using npm, you can manually add Bootbox:

bootbox.min.js

CDN

You can also link to a CDN reference of Bootbox.js:

https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/4.4.0/bootbox.min.js

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
4.x.x Latest 3.0.0 3.3.x 1.9.1
3.x.x 2.2.2 2.3.2 1.8.3
2.x.x 2.0.0 2.0.4 1.7.1
1.x.x 1.3.0 1.4.0 1.7.1

Once you’ve got your dependencies sorted, usage is fairly straightforward and much like any other JavaScript library you’ve ever used. The library creates a single global instance of a bootbox object:

Note the order of the script references

Since Bootbox is a wrapper around Bootstrap's modal functionality, you need to include the libraries in order:

  1. jQuery
  2. Bootstrap
  3. Bootbox

When you’re up and running, check out some examples or the documentation.