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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:52:26+00:00 2026-06-10T02:52:26+00:00

I need to be able to hide and show divs on a page. I

  • 0

I need to be able to hide and show divs on a page.

I need one active by default then when I click on other links to show another div, I need the active div to hide, and so on. So only one div is open at one given time.

I have put a demo together to show what I require, I have got it working so to speak, but I need it to collapse/hide the active div once another link is clicked.

http://jsfiddle.net/QFfzs/3/

  • 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-10T02:52:27+00:00Added an answer on June 10, 2026 at 2:52 am

    You need to add a class to the divs you’re trying to hide, then hide the all divs before toggling like this:

    //adding '.hideMe' to the divs to be toggled
    $(document).ready(function() {
        $('#hideDetailsDiv').hide();
        $('a#hideDetailsButton').click(function() {
            if (!$('#hideDetailsDiv').is(':visible')) {
                $('.hideMe').hide(400);
            }
            $('#hideDetailsDiv').toggle(400);
        });
    });
    

    JSFiddle: http://jsfiddle.net/QFfzs/4/

    Updated JSFiddle: http://jsfiddle.net/QFfzs/5/ (done with less code)

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

Sidebar

Related Questions

I need to be able to hide/show multiple div tags on the same page
I have two divs which I need to show the opposite upon click. You
I need to be able to hide on default specific rows within a table.
I am taking over a one-page site that uses numerous jQuery show/hide instructions to
I need to be able to send a file to another website from server-side
I have multiple toggle divs on the same page, and the div I'm toggling
I need to be able to hide the navbar and tabbar when I tap
I need to be able to hide an image that appears when clicking on
I'm building a treasure hunter app and I need to be able to hide
I need to close a submenu and open a new one if some other

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.