Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8198621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:59:18+00:00 2026-06-07T05:59:18+00:00

I have a master page that have script manager and Javascript/Jquery added in it.

  • 0

I have a master page that have script manager and Javascript/Jquery added in it. See below:

<asp:ScriptManager ID="SM" runat="server" EnablePartialRendering="true">
    <Scripts>
        <asp:ScriptReference Path="~/Scripts/jquery-1.7.2.min.js" ScriptMode="Release" />
        <asp:ScriptReference Path="~/Scripts/Custom.js" ScriptMode="Release" />
    </Scripts>
</asp:ScriptManager>

Custom Js:

$(".section").click(function () {  
    if ($(this).next(".sectiondetail").is(":hidden")) {
        $(this).next(".sectiondetail").slideDown("slow");
        $(this).children('span').text('[-]');
} else {
        $(this).next(".sectiondetail").slideUp("slow");
        $(this).children('span').text('[+]');
}
});

I have placed following html in my ASCX control that is added in content page that uses my master page:

<div class="section">
    <span>[+]</span> General Information
</div>
<div class="sectiondetail" style="display: none;">
     Details go here.
</div>

The JS function does not work as expected. If i add JS function in my ASCX control page, it works as expected. What is wrong here?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:59:19+00:00Added an answer on June 7, 2026 at 5:59 am

    The time you are binding click event you may not have html controls ready/rendered with css section. On will make sure to add click event even the elements are added or rendered after this script block bind click.

    $(".section").on("click", function () {  
        if ($(this).next(".sectiondetail").is(":hidden")) {
            $(this).next(".sectiondetail").slideDown("slow");
            $(this).children('span').text('[-]');
    } else {
            $(this).next(".sectiondetail").slideUp("slow");
            $(this).children('span').text('[+]');
    }
    });
    

    Or You can bind event when document is ready.

    $(function(){
    $(".section").click(function () {  
        if ($(this).next(".sectiondetail").is(":hidden")) {
            $(this).next(".sectiondetail").slideDown("slow");
            $(this).children('span').text('[-]');
    } else {
            $(this).next(".sectiondetail").slideUp("slow");
            $(this).children('span').text('[+]');
    }
    });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Update panel in Master page: <asp:ScriptManager id=CartScript runat=server></asp:ScriptManager> <asp:UpdatePanel id=CartBox runat=server updateMode=Conditional>
I currently have a single jQuery script page that I include in my ScriptManager
in my master page I have <script src=js/jquery-1.7.1.min.js type=text/javascript></script> and plenty other script/link elements.
I have an ASP.NET site that uses JQuery and ASP.NET UpdatePanel and ScriptManager. On
I have a master page that references jquery + jqueryui. Everything is fine. In
I have a script manager on my Master page. There are one or 2
How have you guys handled working with jQuery includes <script type=text/javascript src=jquery.js></script> in Asp.Net
I'm trying to add a script reference to jQuery in my master page so
This is what I have On my .master page i have the following <script
So I have a master page in MVC that has the following code in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.