简体   繁体   English

jQuery 对话框弹出窗口在弹出窗口右上角的关闭框中没有“x”

[英]jQuery dialog popup does not have a "x" in the close box in top right of popup

I have a jQuery popup and the "x" is not appearing in the close box in top right of popup.我有一个 jQuery 弹出窗口,“x”没有出现在弹出窗口右上角的关闭框中。

在此处输入图片说明

I am using this example: https://jqueryui.com/dialog/我正在使用这个例子: https : //jqueryui.com/dialog/

I have included the link and script (two of each).我已经包含了链接和脚本(每个两个)。

My html is:我的 html 是:

  <div class="form-popup form-container autoScroll" id="myForm">
        <table class="table table-hover table-bordered" id="riskTable">
            <thead>
                <tr>
                  <th>rkId</th>
                  <th>Risk Name</th>
                  <th></th>
                </tr>
            </thead>
            <tbody id="riskTablebody">
            </tbody>
        </table>
    </div>

My jQuery is:我的 jQuery 是:

$(function() {
    $('#updateRisk').click(function() {
        $("#myForm").dialog({
            title: "Select Risks",
            width: 600, 
            modal: true, 
            resizable: true,
        });   
    });    
});

I want this as user friendly as possible so having the "X" in red would be an extra bonus!我希望它尽可能用户友好,所以红色的“X”将是一个额外的奖励!

My list of cdn libraries is:我的 CDN 库列表是:

<!-- Validate -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/jquery.validate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/additional-methods.min.js"></script>

<!-- Bootstrap -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>


<!-- DataTables -->
<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.20/dataRender/datetime.js"></script>

<!-- Confirm -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.js"></script>

<!-- Bootstrap Date Picker-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/js/bootstrap-datepicker.min.js"></script>

<!-- Google Maps - not implemented due to cost -->
<!-- <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&callback=myMap"></script>  -->

<!-- Le styles -->
<!-- jQuery -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.structure.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.theme.min.css">

<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker.css" />

<!-- DataTables -->
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.5.1/css/buttons.dataTables.min.css">

<!-- Confirm -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.css">

Just add the necessory libraries and it should work.只需添加必要的库,它应该可以工作。 Below is a working example.下面是一个工作示例。 Also i added a little css to hide the content before model opens.我还添加了一些 css 以在模型打开之前隐藏内容。

#dialog{
  display:none;
}

Working Example:工作示例:

https://jsfiddle.net/mrAhmedkhan/04goxq8h/11/ https://jsfiddle.net/mrAhmedkhan/04goxq8h/11/

OK, the jquery-ui.min.js has been broken since 1.10.好的,jquery-ui.min.js 从 1.10 开始就被破坏了。 So either:所以要么:

  • Install an earlier version;安装较早的版本; or或者
  • Place the library after the bootstrap library (will adversely affect the bootstrap tooltip);将库放在引导库之后(会对引导工具提示产生不利影响); or或者
  • Resolve the conflict with the code below:用下面的代码解决冲突:

     $('#updateRisk').click(function() { if (typeof $.fn.bootstrapBtn =='undefined') { $.fn.bootstrapBtn = $.fn.button.noConflict(); }; $("#myForm").dialog({ title: "Select Risks", width: 600, modal: true, resizable: true, }); showRiskTable(); });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM