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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:03:33+00:00 2026-05-17T22:03:33+00:00

I have this HTML code: <div id=content> <div class=profile_photo> <img style=float:left;margin-right:7px; src=http://gravatar.com/avatar/53566ac91a169b353a78b329bdd35c95?s=50&d=identicon class=profile_img alt={username}/>

  • 0

I have this HTML code:

<div id="content">
  <div class="profile_photo">
   <img style="float:left;margin-right:7px;" src="http://gravatar.com/avatar/53566ac91a169b353a78b329bdd35c95?s=50&d=identicon" class="profile_img" alt="{username}"/>
  </div>
  <div class="container" id="status-#">
   <div class="message">
    <span class="username">{username} Debugr Rocks!
   </div>
   <div class="info">24-oct-2010, 14:05 GMT · <a href="#" class="toggle_comment" title="Comment">Comment (5)</a> · <a href="#" title="Flag" class="toggle_flag">Flag</a> · Via <a href="#" title="Twitter">Twitter</a>
</div>
   <div class="comment_container">
    <div class="profile_photo">
     <img style="float:left;margin-right:7px;" src="http://gravatar.com/avatar/53566ac91a169b353a78b329bdd35c95?s=32&d=identicon" class="profile_img" alt="{username}"/>
    </div>
    <div class="comment_message">
     <span class="username"><a href="#" title="{username}">{username}</a></span> Debugr Rocks! XD
    </div>
    <div class="comment_info">24-oct-2010</div>
   </div>
  </div>
  <div class="profile_photo">
   <img style="float:left;margin-right:7px;" src="http://gravatar.com/avatar/53566ac91a169b353a78b329bdd35c95?s=50&d=identicon" class="profile_img" alt="{username}"/>
  </div>

That is repeated two or more times. What I want to do, is to when I click the “Comments (5)” link, the class “comment_container” appears, but only the one in the same “container” class.

It’s this possible?

  • 1 1 Answer
  • 1 View
  • 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-17T22:03:34+00:00Added an answer on May 17, 2026 at 10:03 pm

    You can use .closest() to go up to the .container then .find() to look inside it, like this:

    $(".toggle_comment").click(function() { 
        $(this).closest(".container").find(".comment_container").show();
    });
    

    You can try it here, if you’re curious about finding other things relative to this here’s a full list of the Tree Traversal functions.


    As an aside, there’s an error in your HTML that needs correcting, this:

    <span class="username">{username} Debugr Rocks! </div>
    

    Should be:

    <span class="username">{username} Debugr Rocks! </span>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello i have an HTML Code like this <div id=top> <div class=panel> <h1>toppanel</h1> <p>Content
I have this HTML code: <div class='com_box'> <div class='com_box_c'> <div class='com_box_info'> <a id='quote'>quote</a> </div>
I have this html code: <div class=action> some_text <a class=delete_action name=q1>some</a> </div> <div class=action>
I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select
Suppose I have the following html: This a test of <code>some code</code>. <div class='highlight'>
I have the following bit of HTML <div class=article>this is a div article content</div>
I have this html code <div id=b_container> <div id=b_header> <div class=header_left><a href=#>link 1 </a></div>
I have this HTML code: <div id=main> <div id=dv_7>...</div> <div id=dv_1>...</div> <div id=dv_8>...</div> <div
I have this simple piece of HTML code: <div> <input type=file name=english-file /> </div>
i have this code $(function() { $('#ans_vote a span').click(function(){alert('working');return false;});}); and this html <div

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.