"Test of nested Boostrap modals"
Bootstrap 3.3.0 Snippet by cdenby

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>Testing to see if Bootstrap 3 will handle modals called from modals</h2> </div> <snap class="lnklbl alert-danger" onClick="CreateFirstModal();">Click me to open the first modal</snap> <div id="modal1holder"> <div class="modal fade" id="myfirstmodal"> <div class="modal-dialog" role="document" id="myfirstmodalchild"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h4 class="modal-title">Modal title</h4> </div> <div class="modal-body"> <p>One fine body…</p> <span class="lnklbl alert-danger" onclick="OpenSecondModal();">Click me for nested second modal</span> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> </div> <div id="modal2holder"> <div class="modal fade" id="mysecondmodal"> <div class="modal-dialog" role="document" id="myfirstmodalchild"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h4 class="modal-title">Modal title</h4> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> </div> </div>
h2 {background-color: lightblue;} .lnklbl {cursor:pointer;} #modal1holderX {display: none;}
function CreateFirstModal(){ $($("#modal1holder").html()).modal(); } function OpenSecondModal(){ $($("#modal2holder").html()).modal(); }

Related: See More


Questions / Comments: