Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How we can remove the "New item button form SharePoint - 2013 ribbon"

$
0
0

Hi All,

How we can remove the "New item button form SharePoint - 2013 ribbon" and I have tried below JavaScript function but not working.

*************** JavaScript ********************************

$(document).ready(function () {     
     ExecuteOrDelayUntilScriptLoaded(init_NewHideButton, "sp.ribbon.js");    
 });

 function init_NewHideButton() {
     setInterval(function () {
         HideNewIconRibbomButton();
     }, 10);
 }

 function HideNewIconRibbomButton() {

     $('a[id*="Ribbon.ListItem.New.NewListItem-Large"]').hide(); //Edit BUtton
     var cc = new SP.ClientContext.get_current();
     var web = cc.get_web();
     var listId = SP.ListOperation.Selection.getSelectedList();
     var selectedItems = SP.ListOperation.Selection.getSelectedItems();
     if (selectedItems.length == 1) {
         var flag = CheckCreatedAuthor(listId, selectedItems[0].id, _spPageContextInfo.userId);
         if (flag) $('a[id*="Ribbon.ListItem.New.NewListItem-Large"]').show(); //Delete Edit Button
     }
     else {
         $('a[id*="Ribbon.ListItem.New.NewListItem-Large"]').hide();

     }
 }

<scripttype="text/javascript">var elem = document.getElementById("Ribbon.ListItem.New-LargeLarge");
elem.style.display ="none";</script>

Thanks & Regards

Deepak Chauhan 


SharePoint 2010 & 2013 and Office-365 Branding and Front End Customization, UI Design


Viewing all articles
Browse latest Browse all 7589

Trending Articles



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