如果您需要在打开新模态之前隐藏所有模态,那么最好的方法是:
我在HTML文件中有两个模式对话框(引起问题)。
哪个模式对话框位于html文件的序列的第一位,单击按钮时正确显示(反之亦然。)>] >> 两个模态对话框都有唯一的ID,并且会被适当地调用,但是一个模态对话框不会出现(如果稍后单独调用)。>> <!-- Modal dialog xyz is the first in the sequence of html code -->
<div class="modal fade" id="xyzModal" tabindex="-1" role="dialog" aria-labelledby="xyzModalTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
.....
</div>
</div>
<!-- Modal dialog abc is the second M.D in the sequence of html code -->
<div class="modal fade" id="abcModal" tabindex="-1" role="dialog" aria-labelledby="abcModalTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
.....
</div>
</div>
在调用模态对话框时我到底在哪里出错。
对于相应的按钮单击,我也正在使用隐藏/显示功能,但是不起作用。
$("#xyzModal").modal('hide');
$("#abcModal").modal('show');
我在html文件中有两个模式对话框(导致问题)。在html文件的顺序中,哪个模式对话框位于第一个位置,单击按钮时正确显示(反之亦然)。都是模态...
如果您需要在打开新模态之前隐藏所有模态,那么最好的方法是:
$(".modal").modal('hide'); $("#abcModal").modal('show');
这可以确保在打开新的模态之前,先隐藏all
如果您需要在打开新模态之前隐藏所有模态,那么最好的方法是: