Why my Dialog box isn't working

2019-06-12 13:43发布

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.

2条回答
等我变得足够好
2楼-- · 2019-06-12 14:23

See here are the jQuery selector. 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...

查看更多
Juvenile、少年°
3楼-- · 2019-06-12 14:43

Because your selector is catches tag with id's and you need hit by class. Try to change your selector to this one: $(".dialog").dialog();

查看更多
登录 后发表回答