How to call a javascript function from web-item?

I have a web-item and I want to append a dynamic variable’s value to the display name of web-item. Have a javascript function that return the variable. How to call this function in web-item?

Can you expand o. What you’re trying to do? It sounds like a web-resource defines to the proper context would work. Take a look at https://developer.atlassian.com/server/jira/platform/web-resource/

Hello,

You can do something like this :

  1. Add the web item in atlassian-plugin.xml
<web-item name="mywebitem" key="mywebitem" section="system.content.action/marker" eight="10">
        <description key="i18n.key.for.desc"/>
        <label key="i18n.key.for.label"/>
        <link linkId="htmlID"/>
        <condition class="MyConditionClass"></condition>
</web-item>
  1. List item
    In your javascript, catch click event on your button :
AJS.$(document).on("click","#htmlID",function(e){
        e.preventDefault();
        e.stopPropagation();

        //your javascript function 
       AJS.$(this).html("<span>Your new button content</span>"); 

        return false;
    });

Try this, it should work.