简体   繁体   中英

Bootstrap v3 modal close event not firing

I have tried all of the following code, and I cannot get the "hidden" modal event to fire. I have read the documentation, and every other SO question I can find, but still to no avail. I am using rails. Here is the code I have tried:

$('#signupmodal').on('hide.bs.modal', function() {
alert("hide");
});

$('#signupmodal').on('hidden.bs.modal', function () {
    alert('hidden event fired!');
});

$('#signupmodal').on('show.bs.modal', function (e) {
    setTimeout(function(){
        alert("show");
    }, 300);
});

$(document.body).on('hidden.bs.modal', function () {
    $('#signupmodal').removeData('bs.modal')
});

$(document).on('hidden.bs.modal', '#signupmodal', function (event) {
    alert("hide");
});

Any insight is greatly appreciated!

I almost don't want to admit this, delete my question and never speak of it again, but turns out jQuery was being loaded twice, and therefore I couldn't access Bootstrap JS.

Thank you for the help anyway! :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM