1

I would like to hide the menu item in a document library that reads "Approve/Reject": enter image description here

Since approval is being managed by a workflow that I created. Most online articles tell the solution to this issue is adding custom CSS to the page so I am trying this method. I have opened the page ~/AllItems.aspx in SharePoint Designer.

Upon inspecting the HTML for the page in my browser, I found the html for that button:

enter image description here

I tried editing AllItems.aspx as follows but the button would not disappear:

enter image description here

Can someone please give a full, working explanation of how I might achieve hiding this button?

Josh Sharkey
  • 107
  • 1
  • 12

1 Answers1

1

You have a small typo in that css. Either try

<style type="text/css">
 button[name="Approve/Reject"] > div > span {
  display: none;
}
</style>

or

<style type="text/css">
 button[name="Approve/Reject"] span {
  display: none;
}
</style>

The reason why your css rule doesnt work is because you are targeting span right under the next sibling level of a button element, but the span shown in your html example is nested under a deeper level.

Alberto S.
  • 823
  • 8
  • 20
  • I will give it a try, thank you. – Josh Sharkey Jun 08 '20 at 20:30
  • As a bonus.... do you know if I can enable or disable this CSS depending on user permission level? – Josh Sharkey Jun 08 '20 at 20:30
  • Sure I can do that. Please edit your post so you include that question and also mention which environment you are working on, thanks – Alberto S. Jun 08 '20 at 22:27
  • btw @JoshSharkey, if the code provided solves your issue, It would be nice to mark my post as an answer so I could redeem the bounty, thanks – Alberto S. Jun 09 '20 at 07:18
  • 1
    I will reward the bounty now, after I can verify the functionality I will mark the answer as corrected. – Josh Sharkey Jun 09 '20 at 20:58
  • Thanks Josh. Regarding ur last question, you can implemente this method https://sharepoint.stackexchange.com/questions/219852/how-to-check-whether-the-current-user-has-edit-permission-for-a-particular-list and then add some styling with javascript based on the resutls , – Alberto S. Jun 10 '20 at 07:51