I am using Twitter bootstrap, I have specified a modal
<
-
For Bootstrap 3.1 you'll want to remove data and empty the modal-content
rather than the whole dialog (3.0) to avoid the flicker while waiting for remote content to load.
$(document).on("hidden.bs.modal", function (e) {
$(e.target).removeData("bs.modal").find(".modal-content").empty();
});
If you are using non-remote modals then the above code will, of course, remove their content once closed (bad). You may need to add something to those modals (like a .local-modal
class) so they aren't affected. Then modify the above code to:
$(document).on("hidden.bs.modal", ".modal:not(.local-modal)", function (e) {
$(e.target).removeData("bs.modal").find(".modal-content").empty();
});