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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:41:16+00:00 2026-06-12T13:41:16+00:00

I have made a dropdown menu that uses tabs to display the specific content

  • 0

I have made a dropdown menu that uses tabs to display the specific content for each menu item.

This is the link to the jQuery tutorial I used for the tabbing functionality:
http://www.jacklmoore.com/notes/jquery-tabs

I have modified the code to suit my needs, but am having trouble finding a way to change the element which the ‘active’ class is applied too. For CSS styling reasons I want the ‘active’ class to be applied to the parent <li> of the <a> which it is currently being added too.

I have tried various solutions including the .parent(); method to no avail. Any advice here would be much appreciated.

Here’s a quick snippet of the code that handles adding the class:

// Keep track of which tab is active and it's associated content
var $active, $content, $links = $(this).find('li.activate-dropdown a');

// If the location.hash matches one of the links, use that as the active tab.
$active = $($links.filter('[rel="'+location.hash+'"]')[0]);
$active.addClass('active');
$content = $($active.attr('rel'));

EDIT:
Example live code – http://jsfiddle.net/jgfg7/3/

  • 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-06-12T13:41:18+00:00Added an answer on June 12, 2026 at 1:41 pm

    Use .closest('li') when you are removing or adding the class to $active.

    See updated fiddle: http://jsfiddle.net/jgfg7/4/

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

Sidebar

Related Questions

I have made a jQuery toggle for a menu that I had in mind.
I have made a small dropdown menu with jQuery and have binded the show
I have a nav bar that has a dropdown menu made with styled tags.
I have a dropdown menu with a couple of values that link to functions.
I'm trying to have a dropdown menu that when the user chooses a specific
I have a drop down menu made with Jquery. Right now, if you hover
So i have this dropdown made in html/css/js.. it slides down on mouseover, but
Basically, I have made a function that selects a certain image to display depending
I have made a dropdown menu. I need a 25px x 25px image to
I have a dropdown menu on http://www.idataresearch.com that displays when the document is finished

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.