In this hint, I need to hide / disable a save button within the list ribbon in SharePoint 2013 via CSS or JavaScript
To be like this
Steps :
Disable the list forms to be not showing as dialog via
- List Settings.
- Advanced Settings.
- Dialogs > Select
No
.
- Go back to All items page > Click on the new item.
- Pick up the Ribbon button ID by clicking on F12.
- Select the button ribbon that you need to hide , In my case, it’s the
save button
.
- Double click on ID > Right Click on Select Copy to copy the Button ID.
- From Site Settings > Edit Page.
- Click on Add web Part > From Media and Content > Add Script Editor.
- Edit Snippet.
Here, you have two options to hide a button ribbon in SharePoint List.
- Via CSS.
<style>
#Ribbon\.ListForm\.Edit\.Commit\.Publish-Large
{ display:none !important; }
</style>
- Via JavaScript.
document.getElementById("Ribbon.ListForm.Edit.Commit.Publish-Large").style.display="none";
Note : The previous steps can be applied to a specific list,
If you need to apply it for all lists in a specific site, you should follow the mentioned steps below :
- Make sure that you have a full control access on the site.
- Create a CSS file with the above CSS.
- Upload it to the Site Assets or Style library of the site,
- Go to Site Settings > Master Page > Alternate CSS URL.
- Check the third option > Click Browse and select the CSS file that has been uploaded earlier in the Site Assets library.
- Click OK.
If you need to apply it for all lists in a Site collection, you should follow the above-mentioned steps but at the root site, you will also need to be a site collection administrator.
Enjoy 🙂