I have a requirement to hide the ribbon control from edit.aspx of a list. The control is enter image description here

the code i used in designer is $('#Ribbon\\.EditingTools\\.CPInsert\\.Media').hide(); asa first statement after document.ready. but this doesnt hide the control. I believe, this is because the html code for this ribbon control gets generated only when the Insert tab is clicked. Where to put this code so that the control appears to be hidden right from the beginning.

  • The above code works well in the .focusin() event – Obiliraj Feb 23 '16 at 10:26
  • You could use setTimeOut but the CSS answer is much nicer – Danny '365CSI' Engelman Feb 23 '16 at 10:47

If you can't get it to work using JS, you should be able to hide it with CSS...

display: none;
| improve this answer | |
  • Your selector is wrong and won't work. Other than that, CSS is the way to go, easy and no events to catch. – Nit Feb 23 '16 at 17:26

A custom action would be appropriate for this and you can control location (where to hide it) as well:

<CustomAction Id="Ribbon.EditingTools.CPInsert.Media.Media.Hidden" Location="CommandUI.Ribbon">
    <CommandUIDefinition Location="Ribbon.EditingTools.CPInsert.Media.Media" />

Here is a full list of Custom Action locations for you: https://msdn.microsoft.com/en-us/library/office/bb802730.aspx CommandUI.Ribbon - That would add the custom action to the ribbon in every location. You might want to use - EditFormToolbar.

| improve this answer | |

Presuming you're using jQuery (you appear to be), this worked for me:


Hope this helps

| improve this answer | |
  • Not sure why this is been voted down? – George Grainger Feb 24 '16 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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