Monday, 15 August 2011

jquery - How to add an event after close the modal window? -



jquery - How to add an event after close the modal window? -

i have code modal:

<-- button 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> <div class="modal-body"> <p>one fine body…</p> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">close</button> <button class="btn btn-primary">save changes</button> </div> </div>

and have code when should been after close moal window:

$('#result').html('yes,result');

tell me please how create when closing modal window(close or hide) executed sec code ?

if you're using version 3.x of bootstrap, right way is:

$('#mymodal').on('hidden.bs.modal', function (e) { // something... })

scroll downwards events section larn more.

http://getbootstrap.com/javascript/#modals-usage

this appears remain unchanged whenever version 4 releases (http://v4-alpha.getbootstrap.com/components/modal/#events), if i'll sure update post relevant information.

jquery twitter-bootstrap modal-dialog

No comments:

Post a Comment