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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:33:07+00:00 2026-06-09T19:33:07+00:00

I have a script that shows more info when clicked and when clicked again

  • 0

I have a script that shows more info when clicked and when clicked again it hides the info. The problem is that when clicked it shows and hides information of all the div’s with the same class name instead of only the one that was clicked. I was looking around and I would think that I need to add “this” somewhere in it so that it only affects the clicked object. Could someone explain what I am doing wrong and how to achieve this effect?

Javascript

 <script type="text/javascript"> 
   this$(document).ready(function(){
   $(".toggle").click(function(){
      $(".hiddenDiv").slideToggle("slow");
        });
   });
  </script>

HTML

       <span class="toggle" onClick='return false'>
            <h4 class='arrow'>Group Health Insurance</h4>
        </span>

        <div class='hiddenDiv'>
            <p><img src="../images/group.jpg" border="0" alt="Group Insurance" align="left" hspace="5" />Group health insurance coverage is a policy that is purchased by an employer and is offered to eligible employees of the company blah blah blah</p>
        </div>
        <hr />
        <span class="toggle" onClick='return false'>
            <h4 class='arrow'>Insurance</h4>
        </span>

        <div class='hiddenDiv'>
            <p><img src="../images/group.jpg" border="0" alt="Group Insurance" align="left" hspace="5" />More info about other types of insurance blah blah blah</p>
        </div>
        <hr />

Thanks for your 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-09T19:33:08+00:00Added an answer on June 9, 2026 at 7:33 pm

    It looks like you’re trying to toggle the style of the next sibling with the hiddenDiv class.

    You can get the next sibling of an element matching a selector using .next:

    $myEl.next('.hiddenDiv');
    

    Since you’re looking for the next sibling of the button that was clicked, you can use this inside the click handler to get the button.

    $(document).ready(function(){
        $(".toggle").click(function(){
            $(this).next(".hiddenDiv").slideToggle("slow");
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I have this JS script that, when the is clicked, it shows more
I have problem with php script. The thing is that it shows me, that
I have this little script that shows one wisdom each day. so I have
I have a script that recursively loops through all the sub directories and compresses
I have following script that executes all the .reg files in the current directory.
I have a python script that uses plt.show() as it's last instruction. When it
I have the script shown below that displays a list of records from a
I have a customized show/hide toggle script that I'm using along with CSS3 transitions
I have script that reads remote file content and writes it to local server.
I have this script that run to fix my menu bar to the browser

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.