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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:15:03+00:00 2026-06-18T15:15:03+00:00

I´m using this to show a sublist: function slidecontent() { $(‘ul.joinus_subtext’).slideToggle(); } and I

  • 0

I´m using this to show a sublist:

    function slidecontent() {
        $('ul.joinus_subtext').slideToggle();
    }

and I have this markup:

    <ul class="joinus">
        <li onclick="slidecontent();">Benefactor
            <ul class="joinus_subtext">
                 <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse lacinia mi a turpis tempor blandit. Vestibulum ante ipsum primis in faucibus orci 
                                luctus et ultrices posuere cubilia Curae; Nullam sit amet ante sed tellus rutrum porta ut non ipsum.</li>
            </ul>
        </li>
        <li onclick="slidecontent();">Protector
            <ul class="joinus_subtext">
                <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse lacinia mi a turpis tempor blandit. Vestibulum ante ipsum primis in faucibus orci 
                                luctus et ultrices posuere cubilia Curae; Nullam sit amet ante sed tellus rutrum porta ut non ipsum.</li>
            </ul>
        </li>
    </ul>

The problem I have is that when I click on one LI it toggles all, not just this one,

What I want to achieve is that if I click on one, it shows its content and if I click on the other, then it hides the one that was open and open the one I clicked. Any ideas how to do this?

  • 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-18T15:15:04+00:00Added an answer on June 18, 2026 at 3:15 pm

    The selector you are using $('ul.joinus_subtext') will give you all the ul with class joinus_subtext and function slideToggle will be applied to all of them, Pass the parent object of element you want to slide to the javascript function and pass it to selector as a context.

    Live Demo

    Html

    <li onclick="slidecontent(this);">Benefactor
    

    Javascript

    function slidecontent(sourceObj) {
        $('ul.joinus_subtext', sourceObj).slideToggle();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using this code to show/hide a div: <a href=# class=show_hide>Show/hide</a> <div class=slidingDiv> My
I am using following code to show a spinning wheel: $(#loading) .hide() .ajaxStart(function(){ $(this).show();
I'm using this currently: $(document).ready(function () { $('ul#nav > li').hover(function () { $('ul:first', this).show();
I am using this function to show a list (ul) on click and hide
I'm using this to show/hide some divs, at the end I have a button
Android newbie here. I'm using this tutorial to show some rows that I fetch
After using this code to get my link to show me 3 database entrys
I'm using this java script library to show ratings http://www.fyneworks.com/jquery/star-rating/#tab-Overview . I'm using below
I'm using this jquery code to show and hide divs on my page. As
I am using this code in my website to show Google search results for

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.