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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:24:38+00:00 2026-06-05T02:24:38+00:00

I am trying to have three divs , initially all are closed.When the div

  • 0

I am trying to have three divs , initially all are closed.When the div is closed a span to right side is shown which is an arrow pointing towards right , when I click any div I want that the corresponding span arrow points down and again when that div is collapsed it should point right.Here is my fiddle.I think I am missing something , can anyone just help me out with this.
Also if any one could just let know better ways of doing this task (entire collapse , expansion) , it would be much appreciated.
Thanks

  • 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-05T02:24:40+00:00Added an answer on June 5, 2026 at 2:24 am

    I’ve made a few amends to your code, including using classes to group elements. Your code was originally set the selected arrow, so you needed to change all the divs back their default state before completing the actions on the clicked one.

    Try this:

    $('.main').click(function() {
        var $el = $(this);
    
        if (!$el.next(".sub").is(":visible")) {   
            // reset all
            $('.sub').slideUp("slow");
            $('.arrow').html("▶");
    
            // set current
            $el.next('.sub').slideDown("slow");
            $('.arrow', $el).html("▼");
        }
    });
    
    <div class="main">
        <span class="arrow">&#9654;</span>
    </div>
    <div class="sub">
        <p>Here there are many images</p>
        <p>Here there are many images</p>
        <p>Here there are many images</p>
        <p>Here there are many images</p>
        <p>Here there are many images</p>
        <p>Here there are many images</p>
    </div>
    

    Example fiddle

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

Sidebar

Related Questions

http://www.magnixsolutions.com/dev/magicmorgan/indexnew.html Im trying to have all three DIVs; left image, flash content in the
I'm trying to have three columns. The left and right columns contain a button
I have a VB project which I'm trying to configure with three build configurations.
What I'm trying to do is have three divs wrapped in a fixed width
I have three columns which are div s acting like table cells, one in
I have three divs with display: inline-block . In every div i have div
All, Say I have the following divs: <div id=rotate_container> <div class=reviews id=item1>This is item
I have three divs vertically stacked. Header, content and footer. All of them have
I have three fields, namely Number1 Number2 Time I am trying to write a
I have three lists of lists, and I'm trying to write a generator function

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.