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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:53:07+00:00 2026-05-25T02:53:07+00:00

I am having a hard time trying to show/hide a div on click. Basically

  • 0

I am having a hard time trying to show/hide a div on click. Basically you click on the flowers (div, the one I want to toggle) and they fade out or hide (which is good) and then disappear (which is not good). I need to be able to click on the flowers and have them fade out and then be able to click (on the same “flowers” div) and have them fade back in or show (like a light switch).

Here’s the JavaScript code I’m using:

$('.show_hide').click(function() {
$("#treeFlowers").fadeToggle()
return false;
});;
});

And here’s the HTML:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>App 1-1</title>
<link rel="stylesheet" type="text/css" href="css/master.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="js/master.js"></script>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="mainWrapper">
<div id="treeFlowers">
<a href="#" class="show_hide"><img src="images/app1-1/treeFlowers.png" alt="tree Flowers"/></a>
</div>
<div id="treeApp">
<img src="images/app1-1/tree.png" alt="light tree"/>
</div>
<div id="textApp">
<img src="images/app1-1/text1.png" alt="text"/>
</div>  
<div id="flowers">
<img src="images/app1-1/flowers.png" alt="flowers" />
</div>
</div>
</body>
  • 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-05-25T02:53:08+00:00Added an answer on May 25, 2026 at 2:53 am

    You should nest the flowers div inside another container div which will be the one being clicked on, lets call it flower-container, then do a toggle on it as follows:

    $(function(){
      $('#flowers-container').toggle(
        function(e){ $('#threeFlowers').hide(); },
        function(e){ $('#threeFlowers').show(); });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having one heck of a hard time trying to figure this out.
I'm having a hard time trying to integrate some things I thought they would
I'm having hard time trying to figure out how to auto-save user data in
I've been having a hard time trying to understand PyPy's translation. It looks like
I'm having a hard time trying to get my team comfortable with interface based
I'm having a hard time trying to make a Java program with just a
For some reason, I'm having a hard time trying to cover the block of
i'm having hard time trying to understand how interrupts work. the code below initialize
I am having a hard time trying to figure out how to properly select
I'm having a hard time trying to figure it out how to organize the

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.