Is there a way to automatically set which link in the top link bar is selected, even if you're not on that page that the link points too.

I'll explain my problem. I have a top link bar with an option called 'Budgets'. When you click on this bar it loads Budgets.aspx and the Budgets item on the top link bar is highlighted. Budgets.aspx has a graphic interface to allow users to choose different budgets. These redirect them to Budget_Option_A.aspx and Budget_Option_B.aspx. When you click on the link to either Option A or Option B, the Top Link Bar then highlights 'Home' (the first option on the bar). Why this happens is pretty obvious.

My question would be, can i put some custom code on the Option.aspx pages that highlights the 'Budgets' link on the top link bar.

It feels sloppy with it automatically switching to the 'Home' top link item. This is running SharePoint 2010 Enterprise. SharePoint Server Publishing is switched off. (A topic of centension with our IS department but its what i have to work with.)

1 Answer 1


You could set the selected links in top bar using jQuery. Add the following code on a script editor web part on your desired page.

$(function() {
    // Assuming that the "Budget" Menu is on the second order of top links bar
    $("#DeltaTopNavigation > div > ul > li > ul > li:nth-child(2) a:first").addClass("ms-core-listMenu-selected");

    // Assuming that the "Home" Menu is on the first order
    $("#DeltaTopNavigation > div > ul > li > ul > li:nth-child(1) a:first").removeClass("ms-core-listMenu-selected");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.