views:

7

answers:

0

I have made a menu that gets subpages with ajax and it works as it should. And now I would like to add a class to the link that was clicked, so I can display an active state on that link? This is what I have: $(document).ready(function(){ loadPage(); });

function loadPage(url) { //loads the menu $('#guiden_menyn').load('manmade/guiden/guiden_menyn.html

content', hijackLinks);

      //loads subpages 
     $('#container').load(url + ' #content', hijackLinks); 

}

function hijackLinks() { $('#guiden_menyn a').click(function(e){ e.preventDefault(); loadPage(e.target.href); }); $('#progress').remove(); }

Any help appreciated, thanks.