Bootstrap: Open Another Modal in Modal Bootstrap: Open Another Modal in Modal javascript javascript

Bootstrap: Open Another Modal in Modal


data-dismiss makes the current modal window force close

data-toggle opens up a new modal with the href content inside it

<a data-dismiss="modal" data-toggle="modal" href="#lost">Click</a>

or

<a data-dismiss="modal" onclick="call the new div here">Click</a>

do let us know if it works.


My solution does not close the lower modal, but truly stacks on top of it. It preserves scrolling behavior correctly. Tested in Bootstrap 3. For modals to stack as expected, you need to have them ordered in your Html markup from lowest to highest.

$(document).on('hidden.bs.modal', function (event) {  if ($('.modal:visible').length) {    $('body').addClass('modal-open');  }});