简体   繁体   English

为什么我的对话框不起作用

[英]Why my Dialog box isn't working

This is the code I am trying and not working, nothing comes up at all 这是我正在尝试但无法正常工作的代码,什么都没有发生

<script type="text/javascript" src="jquery/jquery.min.js"></script>
<script type="text/javascript" src="jquery/jquery-ui.min.js"></script>
<script type="text/javascript">
    function HandleIt()
    {
        var objA = $get('<%= chkBox.ClientID %>');

        if(objA.checked == false)
            $("#dialog").dialog();

            //alert("it works");
    }  
</script>
<div style="width: 800px;">
    <asp:ScriptManager ID="ScriptMan1" runat="server" />
    <div class="dialog">
        <div class="a">
        <asp:Label ID="lbla" runat="server" CssClass="text" />
    </div>
    <div class="b">
        <asp:Label ID="lblb" runat="server" CssClass="text" />
    </div>
</div>

Code I given down works when dialog when it is like this, 我给出的代码在对话时是这样的,

<div class="dialog"> Hahahahaha </div>

I want to use it as message box but its not working out. 我想将其用作消息框,但无法解决。

Because your selector is catches tag with id's and you need hit by class. 因为您的选择器是具有ID的catchs标记,所以您需要按类别进行匹配。 Try to change your selector to this one: $(".dialog").dialog(); 尝试将选择器更改为此:$(“。dialog”)。dialog();

See here are the jQuery selector. 看到这里是jQuery选择器。 You will get the briefly knowledge on it.... 您将获得有关它的简要知识。

and replace your following code 并替换您的以下代码

 $("#dialog").dialog();

With below code 用下面的代码

 $(".dialog").dialog();

And ya please see the jquery selectors... 而且,请参见jQuery选择器...

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

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