1

On our sharepoint there is a serverside issue that morphes links into invalid values. I am able to correct that error clientside using javascript and ive been able to do so on the main page (seattle.html). It works well, but the problem is, that the quick links (that bar on the left) is shown on every page in the sharepoint and as ive included the script only on seattle.html it only runs there.

I have wondered if it would be possible to make the script run on every page that loads the quicklinks navigation bar or if i have to manually include it for each page. Thanks in advance and greetings, Muepe.

/EDIT: Nevermind, the change in seattle.html applied to all pages, but on some pages the list was named zz16_RootAspMenu and on others it was zz17_RootAspMenu. By looping over both all is fine now!

1
  • OK, so you solved the issue? Nice - then add it as an answer to this question or delete it altogether. Thanks for keeping this site clean!
    – Benny Skogberg
    Feb 11 '14 at 12:55
2

How to find TopNavigationMenu on the client side

There are another ways how to find TopNavigationMenu (without dependency on RootAspMenu client Id), for example:

var topNavContainer = $('#DeltaTopNavigation');
var rootAspMenu = topNavContainer.find('ul');  //get RootAspMenu

Referencing JavaScript Files

In addition to referencing JavaScript Files via Master Pages, there is another technique using the ScriptSrc attribute of the CustomAction element in a Feature:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
      ScriptSrc="ajax/navigation.js"
      Location="ScriptLink"
      Sequence="80" >
  </CustomAction>
</Elements> 

Refer an article REFERENCING JAVASCRIPT FILES WITH SHAREPOINT 2010 CUSTOM ACTIONS USING SCIPTSRC for a details

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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