SharePoint 2013: Show/Hide Delete Icon In Ribbon On List Item Selection using jQuery
Check out Best Alternative to InfoPath -> Try Now
This SharePoint tutorial explains, how to show/hide the delete icon in list item selection based on the logged-in user using CSOM/REST API and jQuery. The solution will work to Show/Hide Delete Icon In Ribbon On List Item Selection using jQuery in SharePoint Online or SharePoint 2013/2016.
In my previous tutorial, I have explained how to enable or disable the delete icon in Ribbon on list item selection.
The scenario is to disable the delete icon in the ribbon on the SharePoint List item selection. But when any user logs into the SharePoint site the items created by him should have the delete option on them when only one selection is there.
This can be performed using custom Permission Level with Delete permission removed and item-level or folder-level permissions, but this can cause you a lot of problems managing the broken inheritance of permissions. Or you could write an event handler to prevent deletion of that item but the best way to do it is by using jQuery/ CSOM/ REST.
Show/Hide Delete Icon In Ribbon On SharePoint List Item Selection using jQuery
I have offered a code demo about how to Hide the delete icon in the ribbon on List Item Selection in SharePoint.
Follow the below steps.
Step 1: Navigate to your SharePoint 2013 site.
Step 2: From this page select the Site Actions | Edit Page.
Edit the page, go to the “Insert” tab in the Ribbon and click the “Web Part” option. In the “Web Parts” picker area, go to the “Media and Content” category, select the “Script Editor” Web Part and press the “Add button”.
Without any list item selection to hide delete icon in the ribbon on List:
With Multi list item selection to hide delete icon in ribbon on List:
With Single list item Selection (Logged in) to show delete icon in the ribbon on List.
You may like following SharePoint customization tutorials:
- Show or Hide text box on dropdown selected index change event using HTML and JavaScipt
- How to hide Notebook and Site contents from quick launch in SharePoint Online
- Hide SharePoint list columns based on user permissions
- How to show/hide columns based on value of SharePoint radio button
- Different ways to hide/disable quick edit in a list in SharePoint 2013/2016/Online
- How to remove/hide default title column from SharePoint Online list (modern/Classic)
- Hide content type field in edit form in SharePoint Online/2013/2016
- Disable or Hide Sync Button at SharePoint Online Site and Document Libraries Level
- Hide Site Settings Gear icon for users other than owners in SharePoint 2013/2016
- Hide Edit Links option in SharePoint 2013/2016/Online
- Hide attach file button in SharePoint
I have tried to Hide/Show the delete icon in the ribbon on SharePoint List Item Selection, which will provide you greater flexibility in user interaction on the application. I have achieved this using CSOM/REST API and jQuery in SharePoint 2013. I hope this article is helpful to you.
Download SharePoint Online Tutorial PDF FREE!
Get update on Webinars, video tutorials, training courses etc.