Capture close event on Bootstrap Modal
Solution 1:
This is very similar to another stackoverflow article, Bind a function to Twitter Bootstrap Modal Close. Assuming you are using some version of Bootstap v3 or v4, you can do something like the following:
$("#myModal").on("hidden.bs.modal", function () {
// put your default event here
});
Solution 2:
Though is answered in another stack overflow question Bind a function to Twitter Bootstrap Modal Close but for visual feel here is more detailed answer.
Source: http://getbootstrap.com/javascript/#modals-events
Solution 3:
I tried using it and didn't work, guess it's just the modal versioin.
Although, it worked as this:
$("#myModal").on("hide.bs.modal", function () {
// put your default event here
});
Just to update the answer =)
Solution 4:
This is worked for me, anyone can try it
$("#myModal").on("hidden.bs.modal", function () {
for (instance in CKEDITOR.instances)
CKEDITOR.instances[instance].destroy();
$('#myModal .modal-body').html('');
});
you can open ckEditor in Modal window
Solution 5:
Alternative way to check would be:
if (!$('#myModal').is(':visible')) {
// if modal is not shown/visible then do something
}