Question

In my top navigation there are several links which are basically subsites. Under subsites are further sites or pages. I am using SharePoint 2013 default top navigation in my custom master page. I got its code from "Design Manager".

There is a particular top level subsite which I want to make unclickable. For e.g. currently this is the top navigation.

Home
Subsite1
Subsite2
Subsite3
Subsite4
Subsite5

I want to make Subsite1 unclickable so is there a way to put a # in its URL so when user clicks it, nothing happen.

Was it helpful?

Solution

You could achieve that using jQuery. Get the first link of the dropdown menu and set the href of that link.

$(function() {
    $("#DeltaTopNavigation > div > ul > li > ul > li > ul > li > a:first").attr("href", "#");
});

If you want the link to be completely unclickable, then you could also remove its attribute.

$(function() {
    $("#DeltaTopNavigation > div > ul > li > ul > li > ul > li > a:first").removeAttr("href");
});
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top