NOTE: This solution works only for Bootstrap before version 3. For a Bootstrap 3 answer, refer to this one by user2612497.
What you want to do is:
$('#modalElement').on('hidden', function(){
$(this).data('modal', null);
});
that will cause the modal to initialize itself every time it is shown. So if you are using remote content to load into the div or whatever, it will re-do it everytime it is opened. You are merely destroying the modal instance after each time it is hidden.
Or whenever you want to trigger the destroying of the element (in case it is not actually every time you hide it) you just have to call the middle line:
$('#modalElement').data('modal', null);
Twitter bootstrap looks for its instance to be located in the data attribute, if an instance exists it just toggles it, if an instance doesn't exist it will create a new one.
Hope that helps.
$(modal_selector).remove()
. – Pilgrimageremove
will really delete the modal, so it isn't openable again. Twitter Bootstrap's modal windows aren't really anything magical, so when you reopen a modal dialog you have to reset all the form elements manually (that's been my experience). – Pilgrimage