how to destroy bootstrap modal window completely?

后端 未结 24 850
旧时难觅i
旧时难觅i 2020-11-29 18:51

I\'ve made use of modal window for a wizard implementation which has around 4,5 steps. I need to destroy it completely after the last step(

24条回答
  •  离开以前
    2020-11-29 19:18

    For 3.x version

    $( '.modal' ).modal( 'hide' ).data( 'bs.modal', null );
    

    For 2.x version (risky; read comments below) When you create bootstrap modal three elements on your page being changed. So if you want to completely rollback all changes, you have to do it manually for each of it.

    $( '.modal' ).remove();
    $( '.modal-backdrop' ).remove();
    $( 'body' ).removeClass( "modal-open" );
    

提交回复
热议问题