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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:30:52+00:00 2026-05-31T00:30:52+00:00

I build a website, in this website I have this two buttons by jQuery

  • 0

I build a website, in this website I have this two buttons by jQuery
when I click on the bt1 the image appear and
then I’ll click on the btn2 the first image should dissapear and the second image for this button btn2 appear.

The problem is
I click on btn1 and then click on btn2, when I want to back to btn1 and click it, it not work.
I have to perform a double click on each other, click to open image and the other to close.

I want to click one time to see image and when i click on the second button the first image disappear and open the second image.

And I want that image** appear when I open the website but when I click on any button (btn1,btn2) the image hide disappear.

** 3rd image not for (btn1/btn2) but appear when i open my web n disappear when i click on any image
thank for help

<html>
<head>

<script type="text/javascript">

function showhide_menu(id){
   $("#" + id).toggle();
}

</script>
</head>
<body>
<button onclick="showhide_menu('btn1');">Show/Hide.  </button>

 <button onclick="showhide_menu('btn2');">Show/Hide.  </button>

<div id="btn1" style="display:none;">
    <img src="http://mybroadband.co.za/photos/data/500/apple-logo.jpg"/>
    text text text text text text text text text....</div>

<div id="btn2" style="display:none;">
    <img src="http://www.inquisitr.com/wp-content/2012/02/breaking-dawn-saga.jpg"/>
    text text text text text text text text text....</div>

</body>
</html>
  • 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-31T00:30:53+00:00Added an answer on May 31, 2026 at 12:30 am

    Give the btn-DIVs a class.
    Then hide them before toggling:

    http://jsfiddle.net/qYCUJ/

    HTML

    <div id="btn1" class="btn" style="display:none;">
        <img src="http://mybroadband.co.za/photos/data/500/apple-logo.jpg"/>
        text text text text text text text text text....
    </div>
    <div id="btn2" class="btn" style="display:none;">
        <img src="http://www.inquisitr.com/wp-content/2012/02/breaking-dawn-saga.jpg"/>
        text text text text text text text text text....
    </div>
    

    JS

    function showhide_menu(id){
        $('.btn:not(#'+id+')').hide();
        $("#" + id).toggle();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a website with a uniform layout. These two pages have
I have a website I've built in VS2005, C#, .NET 2.0. This website does
I am trying to build openid login system for my website. To do this
I am trying to build a website with mysql and php. This is the
I created a website but i have a problem. i want to build once
This is a two part question; firstly, does anyone out there have some insight
I have a two tier architecture based website-data layer and UI layer. I have
this is my first time using any StackExchange website, so let's see how it
I have two domains, domain1.com and domain2.com pointing at the same asp.net website which
We have a website load balanced across two servers that calls into a WCF

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.