本文介绍了无法选择或取消选择jQuery UI Modal对话框中的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery UI的对话框显示一些选项,每个选项都表示为复选框.现在,当我打开对话框并单击复选框时,没有任何反应,复选框也没有被选中.我使用的是jQuery UI的最新版本.

I'm using jQuery UI's dialog to show some options, each represented as checkbox. Now when I'm opening dialog, and clicking on checkboxes, nothing happens, checkbox doesn't get checked.I'm using jQuery UI's latest version.

有人可以告诉我怎么了吗?

Can anybody tell me what's wrong ?

这是代码

$('div#attachedDocuments').dialog({
        autoOpen: false,
        height: 300,
        width: 350,
        modal: true,
        title: "Select files",
        buttons: {
            "Ok": function () {
                    $(this).dialog("close");
            },
            Cancel: function () {
                $(this).dialog("close");
            }
        }
    });

这是对话框

<div id="attachedDocuments">
    <asp:Repeater ID="rptAttachments" runat="server"
                  OnItemDataBound="AttachedDocumentsDataBound">
        <ItemTemplate>
            <asp:CheckBox ID="checkBoxDocument" runat="server" />
        </ItemTemplate>
    </asp:Repeater>
</div>

推荐答案

我遇到了类似的问题.这是我一直在想的事情:当您调用 .dialog()时,jQueryUI将为对话框分配 z-index .如果此后在页面上添加了更多元素,则对话框(或其内容)可能会变成其他内容(甚至是不可见的内容)的下方.但是后来我看到了此错误报告,所以我不确定原因了...

I've had a similar issue. Here is what I thought was going on: jQueryUI will assign a z-index to the dialog when you call .dialog(). If you add more elements to the page after that, your dialog (or its contents) might become underneath something else (even something invisible). But then I saw this bug report, so I'm not sure about the cause anymore...

解决方案:在您的CSS文件上为对话框提供非常高的 z-index ,例如 99999 .

The solution: give your dialog a really high z-index on your CSS file, something like 99999.

这篇关于无法选择或取消选择jQuery UI Modal对话框中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 05:00