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

  • SEARCH
  • Home
  • 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 3630534
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:16:56+00:00 2026-05-19T00:16:56+00:00

I am trying to create a menu navigation sort of like tab’s but with

  • 0

I am trying to create a menu navigation sort of like tab’s but with vertical buttons.. When I start the page, the first li class is removed and when I click any other link nothign happens other then my content div’s being shown..

The first link should always be active on page start.

<script type="text/javascript">
$(document).ready(function() {

    var tabContainers = $('div.pages > div');

    $('div.sidemenu ul.list a').click(function () {
        tabContainers.hide().filter(this.hash).show();

        $('div.sidemenu ul.list li').removeClass('active');
        $(this).addClass('active');

        return false;
    }).filter(':first').click();


});
</script>
<div class="sidemenu">
  <ul class="list"> 
 <li class="active"><a href="#first">Login & Password</a></li>
 <li><a href="#second">Contact Details</a></li>
 <li><a href="#third">Company & Branch Details</a></li>
 <li><a href="#forth">Address Details</a></li>
  </ul>
</div>

<div class="pages">
  <div id="first">
    CONTENT 1
  </div>
  <div id="second">
    CONTENT 2
  </div>
  <div id="third">
    CONTENT 3
  </div>
  <div id="forth">
    CONTENT 4
  </div>
</div>

Not sure what I am missing here.. Maybe its cuase I just woke up and still on my first cup of coffee.. 😉

  • 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-19T00:16:56+00:00Added an answer on May 19, 2026 at 12:16 am

    You’re adding the class to the <a> element, but removing it from its parent <li> element.

    $(this).addClass('active');  // "this" is the <a> that received the event
    
       // This removes "active" from the <li>
    $('div.sidemenu ul.list li').removeClass('active');
    

    Looks like you intend for the <li> to have the class. So you’d do this instead:

    $(this).parent().addClass('active');
    

    Or if you don’t mind me mixing a little DOM API in:

    $(this.parentNode).addClass('active');
    

    Now go get a refill! ;o)

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

Sidebar

Related Questions

I am trying to create to a vertical navigation menu using CSS sprites. I
I'm trying to create a page with a header with a navigation menu and
I am trying to create a multi level navigation menu with css. I guess
I'm trying to create a two-level horizontal navigation menu (or menubar) that displays the
I am trying to figure out the best way to create a navigation menu
I'm trying to create some Menu Item with Image & Label, using barry's class
I'm trying to create a navigation menu with menu items that don't always have
I am trying to create a simple menu using li elements, but it only
I'm trying to create an ASP.NET MVC master page so the site navigation on
I am trying to create a dynamic menu with simple navigation. The problem is

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.