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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:26:08+00:00 2026-05-26T18:26:08+00:00

From what I read in the docs, end() will return the initial object. In

  • 0

From what I read in the docs, end() will return the initial object. In my case this should return $(this), right?

$('.el').delegate('a.off', 'click', function(){
  $(this).parents('div').find('a').removeClass('active').end().addClass('active');
  ...
});

but it doesn’t seem to work. I don’t get the addClass('active') applied on the original element (the link a.off).

  • 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-26T18:26:09+00:00Added an answer on May 26, 2026 at 6:26 pm

    Not the initial object, the previously selected elements, which would be .parents('div') in this case. Think about it as a stack and every time you change the selection of elements, they get added to the stack, and .end() removes the last entry of the stack. You’d have to call .end() twice.

    But instead you can also rearrange your method calls and use not to filter out the particular element:

    $(this)
      .addClass('active')
      .parents('div')
      .find('a').not(this)
      .removeClass('active');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string read from another source such as \b\bfoo\bx. In this case,
I'm trying to implement this: from https://docs.google.com/viewer?url=http://www.tinaja.com/glib/bezdist.pdf&pli=1 The following BASIC program uses the method
I read http://docs.djangoproject.com/en/dev/ref/forms/fields/ >>> class CommentForm(forms.Form): ... name = forms.CharField(initial='Your name') ... url =
I read the chapter in the Django docs about the transaction management. From what
I'm having some problems grokking the .end() function in jQuery. The docs I've read
From what I've read in the docs, gen_servers don't trap exits. Moreover, my understanding
I read from some books that Phusion Passenger is the answer to easy Ruby
From what I've read from Herb Sutter and others you would think that volatile
History: I read from one of Knuth's algorithm book that first computers used the
I have read from some article that say's Apple doesn't approve the application which

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.