In “ribbon custom action” in SharePoint Online I want to invoke JavaScript code direct once click on the ribbon button rather than redirect to any aspx page (~appWebUrl/Pages/Default.aspx). But whenever I add JavaScript code in Elements.xml within CommandAction (see xml code below) :
<CommandUIHandlers>
<CommandUIHandler Command="Invoke_Ribbon1ButtonRequest"
CommandAction="javascript: alert('Hello');"/>
</CommandUIHandlers>
</CommandUIExtension >
Deployment doesn’t work, and generates this error:
Error occurred in deployment step ‘Install app for SharePoint’: There where errors when validating the App Package.
Any suggestion? Thanks