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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:38:58+00:00 2026-06-09T16:38:58+00:00

Im having some problems implementing an jQuery UI Accordion widget on my site. I

  • 0

Im having some problems implementing an jQuery UI Accordion widget on my site.

I list with a heading, that i wan’t to be able to colapse/expand.
For this im trying to use the jQuery UI Accordion widget.

But for some reason its not working.

I have this razor view:

<div id="parameter_accordion">
<h3>Parameters</h3>

    @foreach (var item in Model)
    {
        <div>
            <p>@item.Name</p>
        </div>    
    }

The div tag is “pointing” to the function in my JS file (“ConfigApplication.js”):

$("#parameter_accordion").accordion();

Im importing this file along with all the Jquery files in the _Layout.cshtml:

<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />

<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/ConfigApplication.js")" type="text/javascript"></script>

but for some reason the view is not showing as a accordion. Its shoving all content, all the time. Can anyone see what i’m doing 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-09T16:39:00+00:00Added an answer on June 9, 2026 at 4:39 pm

    The general html for a jquery accordion follows the following standard:

    <div id="accordion">
        <h3><a href="#">First header</a></h3>
        <div>First content</div>
        <h3><a href="#">Second header</a></h3>
        <div>Second content</div>
    </div>
    

    Therefore, if you are wanting only one header, then you should not have the div inside the foreach loop and it should look like this:

    <h3><a href="#">Parameters</a></h3>
    
    <div>
        @foreach (var item in Model)
        {
            <p>@item.Name</p>
        }
    </div>  
    

    However, if you are wanting a header for each section, you need to have a <h3> with an anchor tag within it for each unique section. So you should include the tag within the foreach loop. It would look something like this:

    @foreach (var item in Model)
    {
        <h3><a href="#">@item.Name</a></h3>
        <div>
            <p>@item.Name</p>
        </div>    
    }
    

    Also to note, the accordion is not collapsible by default and you need to add that option in order to allow it to be collapsed completely.

    $("#parameter_accordion").accordion({ collapsible: true });
    

    Check out the demo for the jquery UI accordion for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some problems implementing a control that shows a Busy indicator, here is
I'm having some problems implementing an algorithm to read a foreign process' memory. Here
Currently having some problems- now = datetime.datetime.now() month = now.strftime(%B) site = wikipedia.getSite('en', 'wikiquote')
Im having some problems getting the Sticky Footer to work on my site. If
I am having some problems with the PDF files that I make using the
I'm having some problems with some commands in Java. I created a JAR that
I'm having some trouble implementing a fixed table header with CSS and jQuery, though
I'm having some problems implementing an exception system in my program. I found somewhere
I'm having a little problem implementing some jQuery into a page I am doing.
I'm having some problems with implementing javascript controls in my asp.net page. I would

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.