bootstrap modal close event code example

Example 1: on modal close jquery

$('#myModal').on('hidden.bs.modal', function () {
  // do something…
})

Example 2: close bootstrap modal with javascript

$('#myModal').modal('hide');

Example 3: bootstrap modal





Example 4: bootstrap modal prevent close

$('#myModal').modal({backdrop: 'static', keyboard: false})

Example 5: modal dismiss





Example 6: bootstrap on hidden bs modal

$('#myModal').on('hidden.bs.modal', function (e) {
  // do something...
})

Tags:

Misc Example