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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:53:48+00:00 2026-05-16T22:53:48+00:00

I have a list that is being fed in to my page using an

  • 0

I have a list that is being fed in to my page using an ASP.NET repeaters. The repeater contains a div (divContainer) with two divs (divTitle and divDetails) inside it. I’m hiding the divDetails and only want to show it if the user click on divTitle.

This works fine for me when in the first divContainer but all subsequent ones that get generated do not work or will slide down the first divDetails. I’m assuming this is because all the elements that get generated by the repeater have the same ID so it selects the first one. I probably need to look for child elements only or something like that but am struggling to get it working.

Here’s the HTML:

<div id="divContainer">
    <div id="divTitle">Foo</div>
    <div id="divDetails" class="display:none">Foo details</div>
</div>

<div id="divContainer">
    <div id="divTitle">Foo</div>
    <div id="divDetails" class="display:none">Foo details</div>
</div>

What would the JQuery script be to show the correct divDetails when divTitle withing the same divContainer is clicked?

Thanks for your help.

  • 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-16T22:53:49+00:00Added an answer on May 16, 2026 at 10:53 pm

    Give them classes (IDs have to be unique…the root of your issue), like this:

    <div class="divContainer">
        <div class="divTitle">Foo</div>
        <div class="divDetails" style="display:none">Foo details</div>
    </div>
    

    Then find the element relatively, via .find() or .children() in this case:

    $(".divContainer").click(function() {
      $(this).find(".divDetails").toggle();
    });
    

    Here I’m toggling it open/closed, you could also use .slideToggle() for an animation or just .show() if you want it shown only, not toggle-able to hide it again.

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

Sidebar

Related Questions

I have an unordered list that is being loaded from an external file using
I have a list that contains 10**7 lists in the format: big_list = [[1,
I have a list that has two items: projects and groups. Projects can go
I have a List that contains items, for example: 1) https:\\10.12.23\\ 2) https:\\12.23.12.25\\ 3)
I have a list that contain two colums which are type currency. I want
I have a list of data or quotes that are being displayed, I only
I have a List<T> that is in an entity class that is being populated
If I have a deque or list that's being manipulated on different threads, can
I have an unordered list that's being generated from a database. Depending on the
I have a list of variables that are being created on one line. Dim

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.