Reset Bootstrap Modal if not all form steps are complete

拥有回忆 提交于 2019-12-11 03:25:39

问题


I am having a little issue with a Twitter Bootstrap modal. It is customized pretty far.

What we have done is open a modal when the user click complete objective, then press submit button, post() to controller, then load() the next screen inside the modal body. This is a survey that is optional. The user can then fill it out and receive a thank you message which disappears after 3 secs.

Here is the issue: 1. If modal window is closed on survey and another objective is clicked to complete, the survey still shows up in the modal. 2. Same thing happens once user completes survey, try to complete another and the thank you modal pops up.

Question How can I use jQuery to create some sort of function that will reset the modal on close... or how to reset it once the success message is reached.

I guess just know how to create a function that will reset it, then i can call that whenever needed.

Got any ideas?


回答1:


Found the solution!

using the function built in

 $("#myModal").on("hidden", function() { 
 //do something
 });

I was able to reset the html in my modal-body and the buttons as well using simple css class changes.



来源:https://stackoverflow.com/questions/12959331/reset-bootstrap-modal-if-not-all-form-steps-are-complete

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!