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 8523441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:24:38+00:00 2026-06-11T07:24:38+00:00

I can dynamically add new accordion panes, but they don’t work. Any ideas? I

  • 0

I can dynamically add new accordion panes, but they don’t work. Any ideas? I am assuming they aren’t being initialized since they are being added dynamically. They show up when I add them, they just don’t become animated.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>MLE Editor</title>
    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>

    <link href="Styles/site.css" rel="stylesheet" type="text/css" />    

<script type="text/javascript">
    $(document).ready(function()
    {
        //Add Inactive Class To All Accordion Headers
        $('.eventHeader').toggleClass('inactive-header');

        //Set The Accordion Content Width
        var contentwidth = $('.eventHeader').width();
        $('.eventContent').css({ 'width': contentwidth });

        //Open The First Accordion Section When Page Loads
        //$('.eventHeader').first().toggleClass('active-header').toggleClass('inactive-header');
        //$('.eventContent').first().slideDown().toggleClass('open-content');

        // The Accordion Effect
        $('.eventHeader').click(function () {
            if($(this).is('.inactive-header')) {
                $('.active-header').toggleClass('active-header').toggleClass('inactive-header').next().slideToggle().toggleClass('open-content');
                $(this).toggleClass('active-header').toggleClass('inactive-header');
                $(this).next().slideToggle().toggleClass('open-content');
            }

            else {
                $(this).toggleClass('active-header').toggleClass('inactive-header');
                $(this).next().slideToggle().toggleClass('open-content');
            }
        });

        return false;
    });

    function addEvent() {
        var eventsContainer = document.getElementById('eventsContainer');
        var events = eventsContainer.innerHTML;
        events = events + '<h2 class="eventHeader">New event</h2><div class="eventContent"><p>Event options</p></div>';
        eventsContainer.innerHTML = events;
    }
</script>
</head>
<body>
    <form id="form1" runat="server">        
        <div id="eventOptions">
            <a href="javascript:addEvent();">Add Event</a>
            <br />
            <div id="eventsContainer"> 
            <h2 class="eventHeader">Old event</h2><div class="eventContent"><p>Event options</p></div>
            </div>
        </div>
    </form>
</body>
</html>
  • 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-11T07:24:39+00:00Added an answer on June 11, 2026 at 7:24 am

    to get the accordian working on the new items, simply change the click handler to:

    $(document).on('click','.eventHeader',function () {
      if($(this).is('.inactive-header')) {
        $('.active-header').toggleClass('active-header').toggleClass('inactive-header').next().slideToggle().toggleClass('open-content');
        $(this).toggleClass('active-header').toggleClass('inactive-header');
        $(this).next().slideToggle().toggleClass('open-content');
      }
    
      else {
        $(this).toggleClass('active-header').toggleClass('inactive-header');
        $(this).next().slideToggle().toggleClass('open-content');
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class which the programmer can use to dynamically add new properties.
In an RCP application, we dynamically load plugins and our applicaton can add new
I have a page where the user can dynamically add file upload boxes. Adding
The problem in my case is I can dynamically add / remove input boxes,
Im a VB.NET beginnger, can anyone tell me how I can dynamically add a
How can you add a click event to dynamically created menu item? I thought
Can we add the items in the combobox located on the window form dynamically
If buttons are dynamically added in wpf from code behind how can you add
I know that I can dynamically add an instance method to an object by
I am using vs2008 with CrystalReports and I'm wandering how can i dynamically add

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.