I am using Twitter bootstrap, I have specified a modal
<
-
For Bootstrap 3, in modal.js I changed:
$(document)
.on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
.on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open'); })
to
$(document)
.on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
.on('hidden.bs.modal', '.modal', function () {
$(this).removeData('bs.modal').empty()
$(document.body).removeClass('modal-open')
})
(extra spacing added for clarity)
This prevents any unwanted flash of old modal content by calling empty() on the modal container as well as removing the data.