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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:08:35+00:00 2026-06-08T12:08:35+00:00

I have two divs that are hidden from view until corresponding image links are

  • 0

I have two divs that are hidden from view until corresponding image links are clicked on. As is, both divs can be shown at the same time by clicking on one and then the other and I do not want this. I am trying to write an if statement that says if one has been clicked on the other will not display, but I have had no luck. Here is the javascript I am up with that does not work:

 $("#about").click(function () {
    if ($("#aboutdetails").fadeIn("slow") == 'true') {
    $("#contact").css({'display': 'none'});
    }
$("#aboutdetails").click("slow",function () {
        $(this).hide();     
    });
});


$("#contact").click(function () {
    if ($("#contactdetails").fadeIn("slow") == 'true') {
    $("#about").css({'display': 'none'});
    }
$("#contactdetails").click("slow",function () {
        $(this).hide();
    });
});

and here is the original code before I attempted the if statement:

 $("#about").click(function () {
    $("#aboutdetails").fadeIn("slow", function() {
    $("#aboutdetails").click("slow",function () {
            $(this).hide();
        });
    });
});


$("#contact").click(function () {
   $("#contactdetails").fadeIn("slow", function() {
    $("#contactdetails").click("slow",function () {
           $(this).hide();
        });
   });
});

neither are very eloquent as I am still learning!

Thanks for any help in advance

  • 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-08T12:08:36+00:00Added an answer on June 8, 2026 at 12:08 pm

    So you have two different divs named “div1” and “div2” with links “link1” and “link2″…

    $('#link1').click(function() {
        $('#div1').show();
        $('$div2').hide();
    });
    
    $('#link2').click(function() {
        $('#div2').show();
        $('$div1').hide();
    });
    

    Is that what you are trying to do? Click on link1 -> show div1, hide div2. Click on link2 -> show div2 hide div1?

    I’m not sure if that is what you wanted. If not please try and clarify your question.

    Edit with code example from your site: Try this

    $("#about").click(function () {
      $("#aboutdetails").fadeIn("slow", function() {
    
      });
      $("#contactdetails").hide();
    });
    
    
    $("#contact").click(function () {
    $("#contactdetails").fadeIn("slow", function() {
    
    });
    $("#aboutdetails").hide();
    });
    
    $("#aboutdetails").click(function() {
       $("#aboutdetails").hide();
    });
     $("#contactdetails").click(function() {
        $("#contactdetails").hide();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have hidden Divs with .display-link classes that are two levels up from an
I have two divs that are sliding from right to left. I am having
Situation: I have two fixed-height divs, overflow set to hidden on both, and dynamic
I have an array of links that when clicked will bring up a hidden
My issue is that I have two (or more) divs of the same class,
I have a webpage with two side by side overflowing divs that split the
I have a div that contains two other divs,, like this: ---------------------------- | |
I have an ASP.NET page that contains two div's. Both have search fields and
I have two divs one inside another. I have given some border to both
I have two divs that I need to position horizontally dependent on the width

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.