Hi Patric, hope this works - it's untested...

// 'closure' function so click function can see variables
(function(){
        // get the subpage1 link once and store it
        var subpage1 = $('#subMenu>li:first a');
        // set name of class in one place... here!
        var current = 'subcurrent';
        // get links, excluding first level of links
        $('#subMenu ul a').click(function(){
                $('a.'+current).removeClass(current);
                // add class to link clicked and subpage1 link
                $(this).add(subpage1).addClass(current);
        });
})();

Good luck!

Joel Birch

Reply via email to