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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:11:02+00:00 2026-05-13T06:11:02+00:00

Sample html markup below <div class=container answer_comments> <p class=comment_text>Hey that’s not cool.</p> <p class=comment_attribs>By

  • 0

Sample html markup below

<div class="container answer_comments">
<p class="comment_text">Hey that's not cool.</p>
<p class="comment_attribs">By Anonymous User on 01 Dec</p>
<p class="comment_text">Is that really why?</p>
<p class="comment_attribs">By person on 27 Nov</p>
<p class="close_comments" onclick="close_comments()">Close</p>
</div>

JS function:

function close_comments() {
var comments_wrapper = $(this).closest('.answer_comments');
comments_wrapper.slideUp();
}

.answer_comments will not close. is that because im using $(this) wrong? This div is repeated many times on the page, what would be the best way to achieve what I’m trying to do?

  • 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-13T06:11:02+00:00Added an answer on May 13, 2026 at 6:11 am

    check what “this” is, it’s probably referring to the function itself, not the element

    change

    <p class="close_comments" onclick="close_comments()">Close</p>
    

    to

    <p class="close_comments" onclick="close_comments(this)">Close</p>
    

    and the function to

    function close_comments(element) {
      var comments_wrapper = $(element).closest('.answer_comments');
      comments_wrapper.slideUp();
    }
    

    and see what happens

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

Sidebar

Ask A Question

Stats

  • Questions 286k
  • Answers 286k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The regex would be: <asp:((?!\brunat\s*=)[^>])*>. Note that if some attribute… May 13, 2026 at 5:01 pm
  • Editorial Team
    Editorial Team added an answer If you want /company.php?test=AAA001 to redirect to /company/AAA001, do this:… May 13, 2026 at 5:01 pm
  • Editorial Team
    Editorial Team added an answer Maybe these references are more like what you're looking for.… May 13, 2026 at 5:01 pm

Related Questions

I'm really suprised I haven't run into this problem before, but it seems that
I've got four div elements floated to the left. The third div is cleared.
i am starting to build a facebook extension app. i got the api auth
I'm learning JQuery and I wrote a simple AJAX external script for my homepage
Thanks for your help on my last noobie jquery question and since you done

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.