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
As your html code
you can try if ‘_menu’ always present there.
or if you want to select to check its content.