Start New Discussion within our Web Development Community

how do you manually add it when the link is which i would want it to be added to index.html ?

function setActive() {
/*current page function*/
 $('#menu a').each(function(index) {
        if(this.href.trim() == window.location)

this works for any pages that are in the navigation menu.

Why don't you provide a class on the body tag to identify if you are on this page rather than check your current url.


<body class="somesite">

and in your javascript you do this

$('#menu a').each(function() {
  if ($('body.somesite').length) {
This article has been dead for over six months. Start a new discussion instead.