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

Reference a .js file on a spribbon custom action elements.xml

on my javascriptmethods.js file:

function test(){
  alert('test message.');}

on my custom action elements.xml:

    ScriptSrc="/_layouts/.../javascriptmethods.js" Sequence="100">

   <CommandUIHandler Command="MyCommands.Alert"
   CommandAction="javascript:test();" />

not working, what's missing?


share|improve this question
up vote 3 down vote accepted

Everything works fine, I've even created a test project for you: Look at it. Did you check your js file is loaded correctly on the page?

share|improve this answer
this was the mistake Location="CommandUI.Ribbon" thanks a lot for your help – fallout Mar 6 '12 at 13:28

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.