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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:37:09+00:00 2026-05-12T21:37:09+00:00

The snippet below repeats many times per page. When I click .load_comments, how I

  • 0

The snippet below repeats many times per page. When I click .load_comments, how I can select .answer_comments?

I guess the easiest way to do it is to select first the parent (.single_answer) and then just use descendant selectors to select the div I need. I’m having problems selecting the .single_answer parent. Using $(“.single_answer:parent”) selects ALL those divs on the page, which makes sense since they are all parents of something.

I’m not sure if one can use something along the lines of $(this).parent … ? I can’t quite figure out the syntax but I know I’m close.

Thanks for any pointers.

<div class="single_answer">
<p class="answer_author">On 12 Nov X said: </p>
<p class="answer_text">Bla</p>
<a href="#" id="" onclick="return false" class="load_comments">View 2 Comments</a>
<a href="#" id="aid_16-qid_54" onclick="return false" class="comment">Comment</a>
<div class="container answer_form_container"> </div>
<div class="container answer_comments"> </div>
</div>
  • 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-12T21:37:09+00:00Added an answer on May 12, 2026 at 9:37 pm

    Try this:

    $('.single_answer .load_comments').click(function() {
        $(this).closest('.single_answer').find('.answer_comments');
        return false;
    }
    

    This will be a bit more robust to changes in your structure: it allows for finding the nearest ancestor (parent, grandparent, etc).

    Alternatively, if you know that the answer_comments are always another child of the same parent:

    $(this).siblings('.answer_comments')
    

    …will find it too.

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

Sidebar

Related Questions

I have a table defined (see code snippet below). How can I add a
In the below code snippet can i replace char * to const char *
Please see the snippet below and tell me how can I achieve the same
I am using this snippet below, how can i add a second equal statement
Using the snippet below throws me a null pointer exception, but i can't find
I want to modify the code snippet below in such a way, that I
Using the snippet below which uses NLog how can this be done using Enterprise
For the simple snippet below a = raw_input(Enter a number: ) How can I
In the snippet below, if a do CMD+CLICK on link, it doesn't show alert('CMD')
Given the following code snippet below, using GetPropValue(MyComponent,'MySubComponent.Prop1') raises an EPropertyError exception. How can

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.