//This event fires immediately when the show instance method is called.
$('#myModal').on('show.bs.modal', function (e) {
// do something...
});
//This event is fired when the modal has been made visible to the user
$('#myModal').on('shown.bs.modal', function (e) {
// do something...
});
//This event is fired immediately when the hide instance method has been called.
$('#myModal').on('hide.bs.modal', function (e) {
// do something...
});
//This event is fired when the modal has finished being hidden
$('#myModal').on('hidden.bs.modal', function (e) {
// do something...
})