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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:30:45+00:00 2026-06-10T10:30:45+00:00

How can I easily make my own jQuery accordion? I’d like to avoid wasting

  • 0

How can I easily make my own jQuery accordion? I’d like to avoid wasting time trying to adapt other non-standard jQuery UI accordions.

  • 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-10T10:30:47+00:00Added an answer on June 10, 2026 at 10:30 am

    First: Get the jQuery library

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js">
    </script>
    

    Second: Place this in your page

    <!-- NOTE: You MUST give a unique id to ALL the menu items -->
    <div id="item1" class="menuItem">
        First Item
    </div>
    <div>text</div>
    <div id="item2" class="menuItem">
        Second Item
    </div>
    <div>text</div>
    

    Third: Put the script wherever you want

    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $('.menuItem').next().css({ display: 'none' });
    
            $('.menuItem').click(function (event) {
                if ($('#' + event.target.id).next().css('display') == 'none') {
                    collapseAll();
                    $('#' + event.target.id).next().slideDown(500);
                }
            });
        });
    
        function collapseAll() {
            $('.menuItem').next().slideUp(500);
        }
    </script>
    

    Bonus: You can place some images with avoiding headaches

    <div id="item1" class="menuItem">
        <img src='@Url.Content("~/Content/icon.png")' alt="" />
        <span>First Item</span>
    </div>
    <div>text</div>
    <div id="item2" class="menuItem">
        <img src='@Url.Content("~/Content/icon.png")' alt="" />
        <span>Second Item</span>
    </div>
    <div>text</div>
    

    For the correct display of the images to the left of the text you will need some css format

    .menuItem img { float: left; }
    .menuItem span { float: left; }
    /* Avoided further styling for simplicity */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am adding a auction section to my website , i can easily make
I can make a log in for easily, so that's not the problem. What
In Bash I can easily do something like command1 && command2 || command3 which
I'm trying to make Core Data objects inherit from my own custom class rather
make my own UserControl and I can aggregate new TabPages to a TabControl and
I can easily check IP addresses programmatically, but is there any way to set
I can easily calculate the age of a lead in minutes with a formula
I can easily ascend the class hierarchy in Ruby: String.ancestors # [String, Enumerable, Comparable,
We can easily alert anything in java script. Is it possible to get this
You can easily swap two deployments between staging and production environment in the Azure

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.