How can I use bootstrap's modal events? #551

gabriele-ricci-kyklos opened this Issue Oct 14, 2016 · 2 comments


None yet

3 participants


I tried this code

    .on('', function (e) { alert('showing') })

but the event is ignored. How can I use events?

@gabriele-ricci-kyklos gabriele-ricci-kyklos changed the title from How can I use bootstrap modal events? to How can I use bootstrap's modal events? Oct 14, 2016
tiesont commented Oct 16, 2016 edited

show seems to happen earlier than hooking into the jQuery/Bootbox object can allow. You can, however, hook into the event.

    .on('', function (e) { alert('showing') })

There is also the .init function you can call, which should run just prior to the modal being shown:

You would use it like so:

    .init('function (e) { alert('showing') })

.init seems to only be called once, though, so if you happen to do something that reuses a dialog, you're probably better off hooking into

@tiesont tiesont added the Bootstrap label Oct 18, 2016

Like this:

var modal = bootbox.alert({
    message: "My Message",
    show: false
modal.on("", function(e) { console.log("show!"); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment