Hide SharePoint List View Toolbar Menu with JavaScript

hideListViewToolbarItems("Edit in Datasheet", "export to Spreadsheet",  
    "view rss feed","settings:create view");  

function hideListViewToolbarItems()  
    /// <summary>  
    /// By : Ayman M. El-Hattab ( )  
    /// </summary>  
    var menuItem;     
    var menuItemName;  
    var menuItemIndex=-1;  
    var menuItemNames=new Array("edit in datasheet",   
      "open with windows explorer",  
      "connect to outlook",’export to spreadsheet’,’view rss feed’,’alert me’ 
      ,"create column","settings:create view","list settings",  
      "document library settings","explorer view","all documents",  
      "all items","modify this view",   
      "view:create view","new document",  
      "new item","new folder","upload document",   
      "upload multiple documents");  
    var menuItems = new Array("EditInGridButton",   
    var allMenuItems = document.getElementsByTagName(‘ie:menuitem’);  
    for(var i = 0; i < hideListViewToolbarItems.arguments.length; i++ )   
        menuItemName= hideListViewToolbarItems.arguments[i].toLowerCase();  
        for (j=0; j < menuItemNames.length; j++)   
                menuItemIndex = j;  
        for (var l = 0; l < allMenuItems.length; l++)  
                menuItemName = menuItemName.split(":")[1];  
            if (allMenuItems[l].id.indexOf(menuItem)!=-1   
                && allMenuItems[l].text.toLowerCase() == menuItemName)  
                // For FireFox Compatibility  
                var parentNodeOfMenuItem = allMenuItems[l].parentNode;  

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s