无法在jQuery UI模式对话框中选中或取消选中复选框 [英] Can't select or deselect checkboxes inside jQuery UI Modal Dialog

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

问题描述

我正在使用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() z-index C>。如果在此之后向页面添加更多元素,则对话框(或其内容)可能会变为其他内容(甚至是不可见的东西)。但后来我看到这个错误报告,所以我不确定原因了...

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模式对话框中选中或取消选中复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆