I have found several questions to this. I am trying to highlight a selected menu item.
The current code I am using is
<script src="JavaScript/jquery-1.10.2.js" type="text/javascript"></script>
<script>
function active_menu() {
var url = window.location.href;
$('.nav a').filter(function() {
return this.href == url;
}).addClass('current');
}
</script>
<!--Start Menu -->
<ul id="nav">
<li><a href="index.php">Home</a></li>
<li><a href="runetable.php">Rune List</a></li>
<li><a href="alpha.php">Runic Alphabet</a>
<li><a href="trans.php">Runic Transliteration</a></li>
<li><a href="aetts.php">The Aetts</a></li>
<li><a href="runes.php">Runes</a>
<ul>
<li>Freya's Aett</li>
<li><a href="fehu.php">Fehu</li>
<li>Uruz</li>
<li>Thurisaz</li>
<li>Ansuz</li>
<li>Raidho</li>
<li>Kenaz</li>
<li>Gebo</li>
<li>Wunjo</li>
<li>Hagal's Aett</li>
<li>Hagalaz</li>
<li>Nauthiz</li>
<li>Isa</li>
<li>Jera</li>
<li>Eiwaz</li>
<li>Perthro</li>
<li><a href="algiz.php">Algiz</a></li>
<li>Sowilo</li>
<li>Tyr's Aett</li>
<li>Tyr</li>
<li>Berkana</li>
<li>Ehwaz</li>
<li>Mannaz</li>
<li>Laguz</li>
<li>Inguz</li>
<li>Dagaz</li>
<li>Othila</li>
</ul>
</li>
<li><a href="about.php">About</a></li>
<li><a href="contact.php">Contact</a></li>
</ul>
<!-- End Menu -->
This code works… Sort of…
I have found maybe 5 or 6 examples and I have run into the same problem with all of them.
Items 2, 6, and 7 will not highlight. That would be Rune List, Runes, and About.
I do not understand why these entries will not highlight, no matter which solution I try. As I said, I have tried a few and they all work except for those menu items.
Can anyone point me in the right direction? I am going nucking futs trying to figure this out.
Thanks for reading!
Jim