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;? Jun 4, 2020 at 14:56
  • No, I am unsure if I am even editing the correct file. Is my approach correct? Jun 4, 2020 at 18:50
  • 1
    Can you please provide screenshot where exactly these buttons are? Jun 5, 2020 at 8:51
  • please see the updated question @LittSpector Jun 7, 2020 at 5:51
  • check out my answer, it should solve ur issue ;)
    – Alberto S.
    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.

6
  • I will give it a try, thank you. Jun 8, 2020 at 20:30
  • As a bonus.... do you know if I can enable or disable this CSS depending on user permission level? 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
    – Alberto S.
    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
    – Alberto S.
    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. Jun 9, 2020 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.