Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
I am getting error in Jquery as 'null' or not an object.

I have declared the div tag values in jquery. but, still it is getting null object.

see my code below.

Master Page
-----------
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <link type="text/css" rel="Stylesheet" href="Styles/Home.css" />

    <asp:ContentPlaceHolder ID="paneContentPlace" runat="server">


    </asp:ContentPlaceHolder>

</head>


ASPX Page
-------------

<asp:Content ID="Content3" ContentPlaceHolderID="paneContentPlace" runat="Server">

        <script language="javascript" type="text/javascript">
            $(document).ready(function () {
                $("div.ContainerPanel").toggle(   /*********** Error Place ('null' or not null object)******/
                function () {
                    $(this).parent().next("div.Content").show("slow");
                    $(this).attr("class", "ArrowClose");
                });
                alert("Hello Word");

            });
        </script>

        <style type="text/css">
        .ContainerPanel
{
 width:400px;
 border:1px;
 border-color:#1052a0;
 border-style:double double double double;
}
.collapsePanelHeader
{
    width: 400px;
    height: 30px;
    background-image: url('../images/bg-menu-main.png');
    background-repeat: repeat-x;
    color: #FFF;
    font-weight: bold;
}
.HeaderContent
{
 float:left;
 padding-left:5px;
}
.Content
{

}
.ArrowExpand
{
    background-image: url('../images/expand_blue.jpg');
    width: 13px;
    height: 13px;
    float: right;
    margin-top: 7px;
    margin-right: 5px;
}
.ArrowExpand:hover
{
 cursor:hand;
}
.ArrowClose
{
    background-image: url('../images/collapse_blue.jpg');
    width: 13px;
    height: 13px;
    float: right;
    margin-top: 7px;
    margin-right: 5px;
}
.ArrowClose:hover
{
 cursor:hand;
}

</style>

</asp:Content>
  <asp:UpdatePanel ID="upnl1" runat="server">
        <ContentTemplate>
  <div>
                <div id="ContainerPanel" class="ContainerPanel">
                    <div id="header" class="collapsePanelHeader">
                        <div id="dvHeaderText" class="HeaderContent">
                            jQuery Collapsible Panel1</div>
                        <div id="dvArrow" class="ArrowExpand">
                        </div>
                    </div>
                    <div id="dvContent" class="Content" style="display: none">
                        In Album List Page, we will display 3 albums in a row in Tiled format i.e. to repeat
                        In our case, it is LastItem.
                    </div>
                </div>
                <br />
                <div id="Div1" class="ContainerPanel">
                    <div id="Div2" class="collapsePanelHeader">
                        <div id="Div11" class="HeaderContent">
                            jQuery Collapsible Panel2</div>
                        <div id="Div3" class="ArrowExpand">
                        </div>
                    </div>
                    <div class="Content" style="display: none">
                        Test
                    </div>
                </div>
</div>
     </ContentTemplate>
    </asp:UpdatePanel>
Posted
Updated 22-Mar-13 0:23am
v2
Comments
Shubhashish_Mandal 22-Mar-13 7:59am    
In which explorer you have got this error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900