How to reload page on closing a Bootstrap 3 modal
javascript, jquery, twitter-bootstrap, twitter-bootstrap-3
Solution
You can bind the event to reload page on click of close:
$('#myModal').on('hidden.bs.modal', function () {
location.reload();
})
Demo
Problem
My aim is to get the page to reload when a Bootstrap modal is closed. The user can close the modal by clicking on the close button or icon or by clicking away from the modal. My code so far is pretty standard. Taken from: http://getbootstrap.com/javascript/#modals ``` <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> Launch </button> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="myModalLabel">My title</h4> </div> <div class="modal-body"> My content </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save</button> </div> </div> </div> </div> ``` How can I get the page to reload after a modal is closed? Update: Wow, fantastic fast response from everybody. Thank you