如果并非所有表单步骤都已完成,请重置Bootstrap Modal [英] Reset Bootstrap Modal if not all form steps are complete

查看:119
本文介绍了如果并非所有表单步骤都已完成,请重置Bootstrap Modal的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Twitter Bootstrap模式时遇到了一些问题.它是定制的很远.

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

我们要做的是,当用户单击完整的目标时,打开一个模态,然后按提交按钮,按post()到控制器,然后按load()模态体内的下一个屏幕.这是一项可选的调查.然后,用户可以填写它并收到一条感谢消息,该消息在3秒钟后消失.

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.

这是问题所在: 1.如果在调查中关闭了模态窗口,并且单击了另一个目标以完成操作,则调查仍会显示在模态中. 2.用户完成调查后会发生同样的事情,请尝试完成另一次调查,然后弹出谢谢模式.

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.

问题 我如何使用jQuery创建某种将在关闭时重置模式的函数...,或者在达到成功消息后如何重置它.

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.

有什么想法吗?

推荐答案

找到了解决方案!

使用内置功能

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

我能够使用简单的CSS类更改来重置我的模式主体和按钮中的html.

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

这篇关于如果并非所有表单步骤都已完成,请重置Bootstrap Modal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆