4

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
2

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

#Ribbon.EditingTools.CPInsert.Media-LargeMedium
{
display: none;
}
  • 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
1

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">
<CommandUIExtension>
  <CommandUIDefinitions>
    <CommandUIDefinition Location="Ribbon.EditingTools.CPInsert.Media.Media" />
  </CommandUIDefinitions>
</CommandUIExtension>

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.

-1

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

$('li[id$="Ribbon.WebPartInsert.Media"]').hide();

Hope this helps

  • 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.