Quantcast
Channel: Microsoft Online: SharePoint Online forum
Viewing all articles
Browse latest Browse all 10096

Table of Contents Web Part - Hide Libraries, List, Discussions from showing (For SharePoint Online)

$
0
0

Hi,

Hoping someone can help me with this one!

I'm after some JavaScript code that will filter my table of contents so that only sites and sub-sites are visible. I have 3 levels visible via the web part from I need and the table of contents is also showing all the other stuff from the quick launch which I di not want people to see.

The code I have at the moment which is not working is attached.

<script language="JavaScript" type="text/javascript">

 // This script removes lists, libraries and discussions from Table of Contents 
 

var links = document.body.getElementsByTagName("a"); 
for(ii=0; ii<links.length; ii++) 
{

 if(links[ii].outerHTML.indexOf("BaseType") != -1 &&  
 links[ii].parentNode.parentNode.parentNode.parentNode.className == "level-section")

 { 
  links[ii].parentNode.parentNode.parentNode.parentNode.style.display = "none"; 
 }

}
 </script>

Thanks!

Clare


Viewing all articles
Browse latest Browse all 10096

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>