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?

5
  • Have you tried adding !important in your css like display: none !important;? Commented Jun 4, 2020 at 14:56
  • No, I am unsure if I am even editing the correct file. Is my approach correct? Commented Jun 4, 2020 at 18:50
  • 1
    Can you please provide screenshot where exactly these buttons are? Commented Jun 5, 2020 at 8:51
  • please see the updated question @LittSpector Commented Jun 7, 2020 at 5:51
  • check out my answer, it should solve ur issue ;) Commented Jun 8, 2020 at 14:09

1 Answer 1

1
+50

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.

5
  • As a bonus.... do you know if I can enable or disable this CSS depending on user permission level? Commented Jun 8, 2020 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 Commented Jun 8, 2020 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 Commented Jun 9, 2020 at 7:18
  • 1
    I will reward the bounty now, after I can verify the functionality I will mark the answer as corrected. Commented Jun 9, 2020 at 20:58
  • Thanks Josh. Regarding ur last question, you can implemente this method sharepoint.stackexchange.com/questions/219852/… and then add some styling with javascript based on the resutls , Commented Jun 10, 2020 at 7:51

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.