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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:55:32+00:00 2026-06-11T15:55:32+00:00

HTML <p class=heading></p> <div id=div1 class=targetDiv>content1</div> <p class=heading></p> <div id=div2 class=targetDiv>content2</div> <p class=heading></p> <div

  • 0

HTML

  <p class="heading"></p>
<div id="div1" class="targetDiv">content1</div>
 <p class="heading"></p>
<div id="div2" class="targetDiv">content2</div>
 <p class="heading"></p>
<div id="div3" class="targetDiv">content3</div>
 <p class="heading"></p>
<div id="div4" class="targetDiv">content4</div>


<script type="text/javascript">
    jQuery(document).ready(function() {
              jQuery(".targetDiv").hide();
              //toggle the componenet 
              jQuery(".heading").click(function()
              {
                jQuery(this).next(".targetDiv").slideToggle(500);

              });
            });
    </script>

here i’m able to show one div on clicking heading but when i’m going to open another it must get hidden. Infact while i’m opening one div other must get hidden.

pls help me…

Thanks 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-11T15:55:33+00:00Added an answer on June 11, 2026 at 3:55 pm

    This should do the trick:

    <script type="text/javascript">
        jQuery(document).ready(function() {
                  jQuery(".targetDiv").hide();
                  //toggle the componenet 
                  jQuery(".heading").click(function()
                  {
                    jQuery(".targetDiv").slideUp();
                    jQuery(this).next(".targetDiv").slideToggle(500);
    
                  });
                });
    </script>
    

    A small explanation: It first hides all divs and then opens one. I should do so fast that you won’t be able to see it.

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

Sidebar

Related Questions

Ok my HTML markup is as follows: <div class=refine_search_box> <div class=heading>Refine Search</div> <div class=section_heading><a
I have some HTML that looks like this: <h2>Heading</h2> <div class='myClass'> <h2>Another Heading</h2> </div>
We are working with a CMS that generates the following HTML: <h3 class=heading>Heading 1</h3>
I'm defining a DU for the various classes I use within HTML: type Class
I have the following html page: <body> <div class=hide1 style=width:1000px; height:1000px;> <table width=100% border=0
I have the following HTML: <div id=modal ><div class=modal-window> <ul class=action-tabs right> <li><a href=#
I have the following HTML and CSS: <div id=topdevelopments class=colnm colw6 clearfix> <a href=homes-for-sale/development/beaufort-park-6/
Here is the HTML: <div class=categories> <h3> <img src=http://i.imgur.com/TThAk.gif /> <a href=/foo>Foo</a> <p class=subtext>heading</p>
I'm using Twitter Bootstrap. The alert HTML code is: <div class=alert alert-block> <a class=close
I'm working on an HTML class in PHP, so that we can keep all

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.