how to destroy bootstrap modal window completely?

后端 未结 24 865
旧时难觅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 18:57

    The power of jQuery. $(selector).modal('hide').destroy(); will first remove sinds you might have the sliding affect and then removes the element completely, however if you want the user to be able to open the modal again after you finished the steps. you might just wanna update only the settings you wanna have reseted so for reseting all the inputs in your modal this would look like the following:

    $(selector).find('input, textarea').each(function(){
       $(this).val('');
    });
    

提交回复
热议问题