I have looked for a while, but I can't find a solution for this. I want the following:
- Open an URL inside a Bootstrap modal. I have this working off course. So the content is loaded dynamically.
- When an user pushes a button inside this modal, I want the current modal to hide, and immediately after that, I want a new modal to open with the new URL (which the user clicked on). This content of the 2nd modal is also loaded dynamically.
- If the user then closes that 2nd modal, the first modal must come back again.
I have been staring at this for days, hope someone can help me.
Thanks in advance.
You need to add following attribute to the link or button where you want add this functionality:
A detaile blog: http://sforsuresh.in/bootstrap-modal-window-close-current-open-new-modal/
With BootStrap 3, you can try this:-
Tested to work with: http://getbootstrap.com/javascript/#modals (click on "Launch Demo Modal" first).
Using click function:
Heads up:
Make sure that the one you want to show is an independent modal.
Simple and elegant solution for BootStrap 3.x. The same modal can be reused in this way.
I have exact same problem, and my solution is only if modal dialog have [role="dialog"] attribute :