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

The Archive Base Latest Questions

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

So I have 2 divs, each with n-elements. There are n-pairs of elements across

  • 0

So I have 2 divs, each with n-elements.
There are n-pairs of elements across the 2 divs.
Each pair uses the same ‘class’.

Is it possible to remove a particular pair at a time? I currently am using the following code:

    function leaveGroup(id)
    {

        var e = document.getElementById(id);
        var f = $(e).parentNode;

        // Remove everything with the same class name of the parent
        $('body').removeClass($(f).className);

    }

The function isn’t working, am I using class names incorrectly?
Thanks!

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

    You’re misunderstanding jQuery.

    The removeClass function removes a class from an existing element.

    You want to write the following:

    var className = $('#' + id).parent().attr('class');
    $('.' + className).remove();
    

    Note that this won’t work if the parent node has multiple classes.

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

Sidebar

Related Questions

I have 8 divs. Each div has the class 'pre-loader'. In addition to thas
I have one UL having 3 Li, There are divs under each LI which
I have a bunch of divs that are all hidden like this <div class=elements>
I have a number of divs with the same class, that I want to
I have 2 divs above each others, at a given moment one is shown
i have 2 divs next to each other i want mouseleave to fire when
I have three divs stacked on each other but offset so that a part
I have 4 divs next to each other, each containing a link. I want
I have multiple DIVs containing an image in each. When I rollover these DIVs,
I have multiple DIVs with unique IDs. Each DIV onclick slides down and shows

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.