Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Why my javascript not working?

Scheibli Márk July 28, 2017 edited

Hi!

I just want to ask for some help. I made a web item in my atlassian-plugin.xml:

 <web-item key="web-item-example" name="My Web Item" section="operations-delete" weight="200">
<description key="my-web-item-desc">General description</description>
<label>Push me</label>
<link linkId="my_web_item_link"/>
</web-item>

 And i wrote my js like this:

AJS.toInit(function(){
AJS.$('#my_web_item_link').click(function(e){
alert("Documentation");
});
});

 When i press the web item happening nothing. Can you help me?

image.png

I dont know why my code is not working.

2 answers

1 accepted

0 votes
Answer accepted
Scheibli Márk August 15, 2017 edited

I could not solve this problem with web-item, but if somebody needs help then use javascript and put a label into the more operationbar. My soultion is the next:

 $('#opsbar-operations_more_drop').append('<div class="aui-dropdown2-section"><ul><li class="aui-list-item"><a href="#" id="listDialog"><span class="trigger-label">PD rendering</span></a></li></ul></div>');
0 votes
Thor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2017

* Open your Web Developer tools in Chrome / Firefox. Do you see any errors / warnings?

* Maybe AJS.toInit() is not executing your code at the right time. You could try it with 

$(document).ready()

 Or with

$(window).on('load', function() { //do something})
Scheibli Márk August 15, 2017

It is already solved. If i push the button, then the link automaticly load the main page, so it can not call the functions before it. To solve this problem you should put in the link "#". In this case the fucntions will be called (i tried it with only button, not web item).

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events