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

  • Home
  • SEARCH
  • 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 8012657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:23:29+00:00 2026-06-04T19:23:29+00:00

I am making a page where there will be three buttons 1) Mission, 2)

  • 0

I am making a page where there will be three buttons 1) Mission, 2) Vision, 3) Management

Here the functions have to be
1.By clicking the Mission Button a separate div(#mission1) shall open.

2.By clicking the Vision Button another div(#vision1) shall open in the same position of the #mission1 div and also the #mission1 & #mteam divs shall close.

  1. By clicking the Management Button another div(#mteam) shall open in the same position of the #mission1 & #vision1 divs and also the #mission1, #vision1 divs shall close.
    and so on consecutively

I have coded the following
Script

$('document').ready(function() {

   $('#show1').click(function(){

     $('#mission1').slideToggle();  


       });

       $('#show2').click(function(){

           $(' #vission1').slideToggle();



           });


           $('#show3').click(function(){

            $('#mteam').slideToggle();   

               });
});

CSS

 #mission1 
  {
    width:450px; 
    height:200px; 
    background:#069; 
    margin-top:10px;
    display:none; 
    position:absolute; }


  #vission1
  {
    width:450px; 
    height:200px; 
    background:#096;
    margin-top:10px;
    display:none; 
    position:absolute; }

    #mteam
  {
    width:450px; 
    height:200px; 
    background:#CC3;
    margin-top:10px;
    display:none; 
    position:absolute; }​

HTML

<button id="show1">Mission</button>
<button id="show2">Vision</button>
<button id="show3">Management</button>

         <div id="mission1">Abcd</div>
         <div id="vission1">VVVVVVV</div>
         <div id="mteam">MMMMMMMMM</div>

See Demo

I have done it but I am facing the problem only the hide issues. My hiding is being operated only after clicking the same buttons but not clicking the other buttons.

Please help me how shall I do this.
Thanks a lot 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-04T19:23:31+00:00Added an answer on June 4, 2026 at 7:23 pm

    thecodeparadox’s answer is very good. But you can use jQuery.data() to get the div id from the button element. If so, you must do like this:

    <button data-href="mission1">Mission</button>
    var currentDivId = $('button').data('href');
    

    and then try this code:

    <button id="show1" data-href="mission1">Mission</button>
    <button id="show2" data-href="vission1">Vision</button>
    <button id="show3" data-href="mteam">Management</button>
    
    <div id="mission1" class="demo">Abcd</div>
    <div id="vission1" class="demo">VVVVVVV</div>
    <div id="mteam" class="demo">MMMMMMMMM</div>
    

    and the JavaScript code:

    $('document').ready(function() {
        $('#show1, #show2, #show3').click( function() {
            var $div = $('#' + $(this).data('href'));
            $('.demo').not($div).hide();
            $div.slideToggle();
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a page in which there will be array of images. I
Is there a simple way of making the static content of an .aspx page
Please have a look at this page www.pixeli.ca/issue. I have begun making a page
I am making a web page which will allow users to input and view
Working on making an inventory page for work. I have written a page that
Making a simple three question PHP quiz. Each question is displayed on a page
I want to have a button Print all reports which will print 5 different
Here's the setup: I have a page, we'll call it A, which contains a
I'm making a wordpress theme options page, and one of the options I want
I'm making a page where the user upload a file. I want an if

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.