Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Suppose that i have a 4-level deep sharepoint top navigation menu, and i want to replace the menu item links in second and third level with # (href='#')

How can i achieve this? With ajax? And how?

Thanks.

share|improve this question
    
Is this a one-off change or are links at this level supposed to always be disabled? –  Dave Wise Nov 12 '12 at 21:30
    
second option .. –  ozdogan Nov 12 '12 at 22:14
add comment

2 Answers 2

up vote 1 down vote accepted

This works on my test environment to change all all my dropdown links to '#'. I only had 2 levels though so you'll have to tweak accordingly. It should give you an idea though...

$(".s4-tn li.dynamic-children li.dynamic a").attr("href", "#");
share|improve this answer
    
wow! you save life! thanks. –  ozdogan Nov 14 '12 at 17:30
    
actually, i was wondering why you need something like that in a project? i am curious about our requirements are the same –  ozdogan Nov 14 '12 at 17:38
add comment

By default, the global navigation (top nav) is controlled through the Navigation options in Site Settings. To accomplish this, try this:

  • go to the sites that are the parents of where the links should be #
  • click on Site Settings - Navigation
  • Hide the automatically created links for the child items that you want to be #
  • Create a new Heading with the same name as the the one that was hidden
  • Use the Move Up/Down functionality to move the actual child items that should appear under the heading

This this in place, everything that is defined as a Heading in the navigation will be visible but not clickable.

share|improve this answer
    
i was talking about doing this automatically not manual from UI. –  ozdogan Nov 13 '12 at 6:47
1  
With this approach, the change is done once and then it would appear correctly regardless of the navigation provider used. Anything else would require using Javascript to identify the elements that you need to change and then changing them. Using the CSS selectors that jQuery supports would probably be a good way to find these items. Naturally, the selector itself would vary with the menu but it should be possible to do this in one or two lines of javascript with jQuery. Something like $('menu node > childnode a, menu node > childnode > childnode').attr('href','#'); –  Dave Wise Nov 13 '12 at 16:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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