I have a modal form, which sometimes requires the second modal to be open to set or display some data. I can run the first and second modals in order, but when I close the βtopβ modal, both modules are hidden. Is it possible to hide one modal at a time?
Show Modal One:
$('#content').on('click', "a#AddItemModal", function () { var id = $(this).attr('value'); var val = '/AddItems/id:' + id; $('#addItemBody').load(val); $('#addItemModal').modal({}); });
Modal:
<div class="modal fade hide" id="addItemModal" tabindex="-1" role="dialog"> <div class="modal-body"> <p id="addItemBody"></p> </div> <div class="modal-footer"> <a href="#" class="btn" data-dismiss="modal" id="good">Close</a> </div> </div>
Show modal two:
$('#test_embed').click(function () { var val = $('#formEmbed').val(); $('#myModalLabel').html('Embed Preview'); $('#embedBody').html(val); $('#embedModal').modal({}); });
Modal second:
<div class="modal fade hide" id="embedModal" tabindex="-1" role="dialog"> <div class="modal-header"> <h3 id="myModalLabel">Embed Preview</h3> </div> <div class="modal-body"> <p id="embedBody"></p> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal">Close</button> </div> </div>
richj source share