Reload content in modal (twitter bootstrap)

前端 未结 14 1751
青春惊慌失措
青春惊慌失措 2020-12-02 04:38

I\'m using twitter bootstrap\'s modal popup.


      
      
14条回答
  •  执念已碎
    2020-12-02 05:24

    To unload the data when the modal is closed you can use this with Bootstrap 2.x:

    $('#myModal').on('hidden', function() {
        $(this).removeData('modal');
    });
    

    And in Bootstrap 3 (https://github.com/twbs/bootstrap/pull/7935#issuecomment-18513516):

    $(document.body).on('hidden.bs.modal', function () {
        $('#myModal').removeData('bs.modal')
    });
    
    //Edit SL: more universal
    $(document).on('hidden.bs.modal', function (e) {
        $(e.target).removeData('bs.modal');
    });
    

提交回复
热议问题