最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Bootstrap 3 - open modal from another modal - Stack Overflow

programmeradmin2浏览0评论

Is it possible in Bootstrap 3 to open modal from another modal? I have modal windows with content loaded from external html files.

  1. I'm opening the modal window. There I have a form to submit.
  2. After clicking the submit button I would like to go to the next step with a new modal window (and a new content from another html file).

As far as I know you can't have two modal windows simultaneously, so I have to close the first modal and then open the second one. The problem is I have to do after clicking the submit button in the first modal.

I've tried to use the data-dismiss="modal" with data-toggle="modal" attributes on the submit button but they only hide the first modal, the background in still dark and nothing happens.

Is it possible in Bootstrap 3 to open modal from another modal? I have modal windows with content loaded from external html files.

  1. I'm opening the modal window. There I have a form to submit.
  2. After clicking the submit button I would like to go to the next step with a new modal window (and a new content from another html file).

As far as I know you can't have two modal windows simultaneously, so I have to close the first modal and then open the second one. The problem is I have to do after clicking the submit button in the first modal.

I've tried to use the data-dismiss="modal" with data-toggle="modal" attributes on the submit button but they only hide the first modal, the background in still dark and nothing happens.

Share Improve this question edited Nov 21, 2017 at 6:15 Hasan Fathi 6,1064 gold badges47 silver badges66 bronze badges asked May 29, 2014 at 10:24 user3553682user3553682 6
  • There is a data-target attribute, have you used that? .. try adding data-target='#(id of the modal div)' to the close button. – brainless coder Commented May 29, 2014 at 10:27
  • I have it. Button looks like this: <button class="uploadSection__addBox col-lg-12 col-md-12 col-sm-12 col-xs-12" data-dismiss="modal" data-toggle="modal" href="upload1b.html" data-target=".popModal"> – user3553682 Commented May 29, 2014 at 10:31
  • try using id instead of class .popModal – brainless coder Commented May 29, 2014 at 10:38
  • I guess, you have to manually close then. – brainless coder Commented May 29, 2014 at 10:51
  • 2 Yes.. $("...").modal('show');or $("...").modal('hide'); check here - getbootstrap.com/javascript/#modals-usage – brainless coder Commented May 29, 2014 at 11:00
 |  Show 1 more comment

1 Answer 1

Reset to default 15

you can use http://jschr.github.io/bootstrap-modal/bs3.html for that; check stackable example.

发布评论

评论列表(0)

  1. 暂无评论