Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 另一个模式内的引导模式-关闭按钮问题_Javascript_Jsp_Bootstrap 4_Modal Dialog_Bootstrap Modal - Fatal编程技术网

Javascript 另一个模式内的引导模式-关闭按钮问题

Javascript 另一个模式内的引导模式-关闭按钮问题,javascript,jsp,bootstrap-4,modal-dialog,bootstrap-modal,Javascript,Jsp,Bootstrap 4,Modal Dialog,Bootstrap Modal,在我的JSP页面中,我有一个显示另一个模式(内部模式)的页面的模式 第一种模式: <div class="modal-dialog modal-lg" style="background: white; width: 90% !important"> <input type="hidden" id="report-request-data-id" value="${requestId}

在我的JSP页面中,我有一个显示另一个模式(内部模式)的页面的模式

第一种模式:

<div class="modal-dialog modal-lg"  style="background: white;  width: 90% !important">
<input type="hidden" id="report-request-data-id" value="${requestId}"/>
<div class="modal-body">
  <div id="reportDataDetailsDiv"></div>
</div>
<div class="modal-footer">
              
    <label class="btn-is float">
        <spring:message code='close.label'/>
        <input type="button" id="close_report_request_view" class="col-xs-3 col-lg-1 col-md-1" data-dismiss="modal" style="display: none;"/>
    </label>
              
    </div>
</div>

内部模式(加载到上面id为“reportDataDetailsDiv”的div中):

当我在内部模式中单击“关闭”按钮时,问题发生了。当我这样做时,两个模态都会关闭,但是我希望关闭操作对于每个模态都是独立的。我应该如何正确地做到这一点


谢谢。

当您在
reportDataDetailsDiv
中加载其他模态时,您可以使用主模态中的
.show()
显示它,并且每当单击
close
按钮时,您可以删除添加在
reportDataDetailsDiv
中的整个
div

演示代码

//假设添加了其他模态,如下所示
$(“.addmodal”)。单击(函数(){
//附加模态undr div
$(“#reportDataDetailsDiv”).html('要显示的某些消息…)
$(“.modal child”).show();//显示该模态
$(this.hide();
$(“#关闭报告(请求)视图”).prop('disabled',true);//禁用主模式按钮
})
//单击“关闭”按钮以添加模式
$(文档).on('单击','.cus关闭模式btn',函数(){
$(this).closest(“.modal child”).remove();//删除整个div
$(“#关闭报告(请求)视图”).prop('disabled',false);//启用主模式按钮
});

单击我打开其他模式
接近

Hi,其他模态是如何显示的?另外,您可以使用jquery吗?它是使用Ajax调用在Javascript中加载的。是的,我使用jquery处理内部模式的关闭。但一旦它关闭,第一个模式将被冻结,无法滚动。因此,我需要一个干净的方法来做这件事。
<div class="modal-dialog modal-lg" style="background: white;border-radius: 6px;">
<div class="modal-body">
<div class="modal-content">
<div class="col-centered col-lg-12 col-xs-12 ">


.....etc


<div class="modal-footer">
              
        <label class="btn-is float">
            <spring:message code='close.label'/>
            <input type="button" class="cus-close-modal-btn col-xs-3 col-lg-1 col-md-1" style="display: none;"/>
        </label>
              
    </div>
    </div>
    </div>
</div>