SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a way to hide a button from the ribbon using javascript, but to do this I need to wait until the elements of the ribbon are loaded.

Is there a way to detect such event?

share|improve this question
Any reason why you can not use a HideCustomAction: – Robert Lindgren May 17 '13 at 9:10
Because I want to hide the Action under some conditions – must19 May 17 '13 at 9:12
Must19, i have similar issue of DOM being not available. How were you able to accomplish this? Thanks – user21997 Jan 15 '14 at 23:02
up vote 5 down vote accepted

Here is some js that should load efter the ribbon is loaded:

SP.SOD.executeOrDelayUntilScriptLoaded(function() {
         // Your code here

More about modifying in this blogpost


// Fires ‘ribbontabselected’ after the ribbon has been initialized after load
ExecuteOrDelayUntilScriptLoaded(function () {
var pm = SP.Ribbon.PageManager.get_instance();
pm.add_ribbonInited(function () {
 // Your code here
}, ‘sp.ribbon.js’);

from here

share|improve this answer
Thanx for the response. I tried this before, but do not garantee that the elements are attached to the dom. – must19 May 17 '13 at 9:24
Well I am not aware of any other events like "ribbon is loaded", so maybee you have to add a small delay in your code just to make sure all is loaded and well – Robert Lindgren May 17 '13 at 9:28
Updated with a more "complex" sample – Robert Lindgren May 17 '13 at 9:32
This worked fine. Thanx for helping – must19 May 17 '13 at 9:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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