Leo Loki Leo Loki - 1 year ago 90
jQuery Question

How to add an event after close the modal window?

I have code modal:

<-- Button to trigger modal -->
<div id="result"></div>
<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>

<-- Modal -->
<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
<div class="modal-body">
<p>One fine body…</p>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>

And i have code when should been after close moal window:


Tell me please how to make that when closing the modal window(close or hide) executed a second code ?

Answer Source

I find answer. Thanks all but right answer next:

$("#myModal").on("hidden.bs.modal", function () {

Events here http://bootstrap-ru.com/javascript.php#modals

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download