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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:30:06+00:00 2026-05-25T11:30:06+00:00

For instance I have this code: $(‘.note .exit’).click(function() { $(‘.note’).fadeOut(); }); And on my

  • 0

For instance I have this code:

$('.note .exit').click(function() {
  $('.note').fadeOut();
});

And on my HTML there are two instances of .exit and .note. As in:

<div class="note">
        <img src="images/exit.png" class="exit"/>

        <p>Some text.</p>   
</div>

<div class="note">
        <img src="images/exit.png" class="exit"/>

        <p>Some other text.</p> 
</div>

The problem is when I click the close button (exit image) of one .note, the other .note also closes. How do I revise the code so that it only applies to that particular .note class that I am closing?

  • 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-25T11:30:07+00:00Added an answer on May 25, 2026 at 11:30 am

    Use .closest() [docs] to get the closest ancestor that matches a selector:

    $('.note .exit').click(function() {
      $(this).closest('.note').fadeOut();
    });
    

    Given your structure, you could also use .parent() [docs].

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

Sidebar

Related Questions

For instance I have this html code <div class=messageContainer> <div class=message> </div> </div> ---Here
I have this code to get the Cursor once for this instance, and the
I have this line of code (splits is an instance variable): splits = [[NSMutableArray
I have this code. A base class that create a new instance of the
For instance, I have this code: <Grid> <Rectangle Name=TheRectangle Fill=AliceBlue Height=100 Width=100> </Rectangle> </Grid>
I have this code which Invokes a MethodInfo: try { registrator.Method.Invoke(instance, parameters); } catch{
In .NET/C#, I want to validate some html code. For instance I have the
I have this C# code to enumerate controls of a Form instance: private void
I have this code to extract title: soup = BeautifulSoup.BeautifulSoup(urllib.urlopen(url)) title = str(soup.html.head.title.string).lstrip(\r\n).rstrip(\r\n) Some
I have this code: $(document).ready(function() { ofertas_sort = function(sort_key) { // array of offer

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.