简体   繁体   中英

Can't capture Bootstrap 3.3.6 on close modal event

I'm trying to trigger another event on modal close event, here's what I've tried.

$(document).on('hidden.bs.modal', '.modal', function () {
    alert("modal is closed");
});

but unfortunately, it does not work like 'nothing happen'. Any help, clues, ideas, suggestions, recommendations please?

UPDATE

Here's my HTML markup

<button class="btn thehide" data-toggle="modal" data-target="#notification_dialog" id="notification_trigger_button">Open dialog</button>
    <div id="notification_dialog" class="modal fade" tabindex="-1">
        <div class="modal-dialog">
          <div class="modal-content" id="text">
            <div class="modal-header padding_zero">
              <!-- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> -->
              <h4 class="modal-title display_table full_width text_transform_uppercase">Dialog</h4>
            </div>
            <div class="modal-body">
            </div>
            <div class="extend cler j_line"></div>
            <div class="modal-footer">
              <button class="btn btn-default margin_zero" data-dismiss="modal">Close</button>
            </div>
          </div>
        </div>
    </div>

Check maybe that http://jsfiddle.net/h3WDq/1370/

If I anderstand well, is what you want.

$('.modal').on('hidden.bs.modal', function (e) {
  alert("Hello");
})

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