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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:59:51+00:00 2026-06-08T18:59:51+00:00

I have a simple nav menu: <ul> <li><a href=index.php id=home_menu>Home</a></li> <li><a href=purchase.php class=selected id=information_menu>Information</a></li>

  • 0

I have a simple nav menu:

<ul>
<li><a href="index.php" id="home_menu">Home</a></li>
<li><a href="purchase.php"  class="selected" id="information_menu">Information</a></li>
<li><a href="purchase.php" id="contact_menu">Contact</a></li>
</ul>

I am trying to set the correct menu item to be selected. Some of the menus will have sub menus so I don’t think I want to do it by it’s URL, so I have set a meta data tag in each page with the correct tabs’ id:

<meta name="selected_nav_tab" content="home" />

Then get the id via jQuery:

$(document).ready(function () {

//set appropriate nav menu to selected
$('#nav li a').removeClass('selected');

//determine which tab should be selected
var selected_tab = $('meta[name=selected_nav_tab]').attr("content");
});

How can I use that id(“var selected_tab”) to select the home tab?

something like:

$(#selected_tab).addClass('selected');

Probably a no brainer…

Thank you for bailing me out of my head again,

Todd

  • 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-08T18:59:52+00:00Added an answer on June 8, 2026 at 6:59 pm

    As your html code

    you can try if ‘_menu’ always present there.

    $('#' + selected_tab +'_menu').addClass('selected');
    

    or if you want to select to check its content.

    $('#nav li a').contains(selected_tab).addClass('selected');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok I have a inline list of buttons. <ul id=nav> <li class=home><a href=#>Menu Item</a></li>
I have a simple nav bar like so: <ul class=nav> <li><a href=<%= index_url %>>Home</a></li>
I have simple element: <a id=a1 href=# style=position:absolute; top:0; left:0; nav-index:1; nav-down:#b1; nav-right:#a3; nav-left:#a1;
I have the following simple 3 level menu structure: <nav class=main-nav class=list> <ul> <li
I have a simple nav made up of the following HTML; <div class=inner> <div
I have a simple horizontal nav menu that uses highly-styled anchors for buttons. Now,
I have simple class with width and height member fields which define number of
I have simple php validation form that is halfway working. If you leave the
My goals: I want to have #nav to be divide into menu-left and menu-right,
I have this HTML <ul class=nav> <li>Link 1</li> <li>Link 2</li> <li>Link 3</li> </ul> <ul

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.