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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:58:15+00:00 2026-06-01T13:58:15+00:00

Hi i am building a jquery accordion menu using VS2008 and MVC2. My requirement

  • 0

Hi i am building a jquery accordion menu using VS2008 and MVC2.

My requirement is to refresh the contents of the accordion and repopulate it when a user selects an item from a dropdownlist

For this i am using a jquery ajax call which returns data with and tags like below

<h3>
  <a href="#">Masters</a>
</h3>
<div>
  <ul>
    <li>
      <a href="#" onclick="pageclick('..\TRAN\EmpMst.aspx',1)">Employee Master</a>
    </li>
    <li>
......
...

The first time on page load the accordion looks fine. But whenever i change the contents dynamically it looks awfull with weird CSS

Accordion Before & After Dynamic Update

here is my ajax call

        $('#moduleList').change(function() {
            var rootPath = '<%=Url.Content("~/")%>';
            $.ajax({
                type: "POST",
                url: rootPath + "Home/GetMenu/",
                data: { moduleid: $(this).val() },
                success: function(result) {
                    $('#accordion').html(result);
                    //$('#accordion').append(result);
                    $('#accordion').accordion('destroy');
                    $('#accordion').accordion({
                        fillSpace: true, collapsible: true
                    });
                },
                error: function(error) { alert(error); }
            });

        });

am i doing something wrong ?

  • 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-01T13:58:17+00:00Added an answer on June 1, 2026 at 1:58 pm

    Thanks everybody for your help. I finally got it right. Actually i missed a little CSS.

    My IE was not showing the html with any css at all. So it was difficult to findout whether something is changed or not. Thanks to Tuan who saved my day. Once i started using Firebug it was crystal clear that a custom css was missing. Here is the updated Code just in case any one is interested.

        $('#moduleList').change(function() {
            var rootPath = '<%=Url.Content("~/")%>';
            $.ajax({
                type: "POST",
                url: rootPath + "Home/GetMenu/",
                data: { moduleid: $(this).val() },
                success: function(result) {
                    $('#accordion').html(result);
                    //$('#accordion').append(result);
                    $('#accordion').accordion('destroy');
                    $('#accordion div').addClass('navMiddle');  // I missed this at first
                    $('#accordion').accordion({
                        fillSpace: true, collapsible: true
                    });
                },
                error: function(error) { alert(error); }
            });
    
        });
    

    And Here is the CSS for the Accordion menu items.

    .navMiddle{
     position:relative;
    }
    .navMiddle ul {
        margin:0px;
        padding:0px;
        text-align:left;
        list-style:none;
    }
    .navMiddle ul li {
        font-size:11px;
        color:#003366;
        font-weight:normal;
        white-space:nowrap;
        position:relative;
        border-bottom:dotted 1px gray;
        padding-top:4px;
        padding-bottom:4px;
    }
    .navMiddle ul li:hover {
        background-color:#e5effa;
    }
    .navMiddle ul li a:link {
        text-decoration:none;
        color:#003366;
    }
    .navMiddle ul li a:visited {
        text-decoration:none;
        color:#003366;
        margin-top:3px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a jQuery based tree menu using jQuery sortable(). Here is my current
I'm building a jQuery sortable list where the user can add items from a
I´m building a jquery animation from a multidimensional array, and in the callback of
I am building a wordpress site using jQuery with cycle plugin to cycle through
I am using the jquery accordion for display information for a website. i make
I'm building a jQuery Mobile site, using PHP to interact with a MySQL database
I am building a jQuery plugin and i'm using a variable in it which
I am building a custom jQuery plugin which allows the user to delete records
I am presently building a rather interesting UI, such that a JQuery Accordion is
I am building jQuery UI sortable to store order in the database using serialize

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.