Question

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:

<CustomAction
    Location="CommandUI.Ribbon"
    ScriptSrc="/_layouts/.../javascriptmethods.js" Sequence="100">


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

not working, what's missing?

spregards

Was it helpful?

Solution

Everything works fine, I've even created a test project for you: http://www.4shared.com/zip/EwqRtH6c/ScriptLinkTest.html. Look at it. Did you check your js file is loaded correctly on the page?

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top