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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:51:55+00:00 2026-06-03T21:51:55+00:00

Thanks in advance for the help, because I am a complete newb when it

  • 0

Thanks in advance for the help, because I am a complete newb when it comes to jQuery. First, let me explain what I’m trying to do. I am building a wordpress theme, and I want to make comments viewable in the list of posts instead of just the individual posts as is default behavior. To keep the comments list from being out of control on every post, I want to use jQuery to hide them until you click a button. Here is an example of the html from one of the posts:

<div class="comments_section>
  <p class="comments_link">1 Comment</p>
  <p class="PostAComment_link">1 Comment</p>
  <ul class="Comments">
    <li>Comment1</li>
    <li>Comment1</li>
  </ul>
</div>

Then I have the following jQuery:

jQuery(document).ready(function() {
jQuery(".Comments").hide();
//toggle the componenet with class msg_body
jQuery(".comments_link").click(function()
{
  jQuery(".Comments").slideToggle();
});

So when you click the text with the class .comments_link, it unhides/hides the UL with the class of .Comments. It works, except clicking the link toggles ALL the ULs with that class. How can I target just the .comments div that is within the specific .comments_section div?

Thanks again!

  • 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-03T21:51:57+00:00Added an answer on June 3, 2026 at 9:51 pm

    You can try this:

    jQuery(this).siblings(".Comments").slideToggle();
    

    Where within the click event handler this is the element clicked, so jQuery(this).siblings() gives you (obviously) the siblings of that element, and the .siblings() method optionally lets you select siblings that match a particular selector (in this case, “.Comments”).

    This assumes you have multiple “comments_section” divs each of which has only one comments link and comments list in it.

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

Sidebar

Related Questions

First off, thanks in advance for your help. This issue is driving me nuts.
Thanks in advance for your help experts. I want to be able to copy
I am using c# .net. Thanks in advance for any help. I have searched
Thanks for any help in advance, I can't wrap my SQL skills around this
thanks in advance for reviewing my post. I've only been using jquery for about
Thanks in advance for any help. I am new to python, but not particularly
and thanks in advance for your help! Here's my situation: I have a set
Hi everyone and thanks in advance for your help. This is the situation: I'm
First I have searched a lot before asking ,so thanks in advance for any
Thanks in advance for any help. I've got two combo boxes which I'd like

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.