Javascript does not reload on JIRA 5

Hi,

I have a javascript to pre-populate value for my custom field based on user log in, it works perfectly fine until the user change the project which has different context of the field. For example, user log in is in "inhouse" group, "Client" custom field (select list) change to "inhouse" value, then if user select another project which has the same context, the value is still the same. However, if user select another project which has different context (different select list value), the "Client" field is reset and my script does not reload again. Please advise how can I reload the script whenever user select different project? window.onload doesn't work from my understanding.

Thanks,

2 answers

1 accepted

For dinamically loaded elements you can use jQuery.on function or jQuery LiveQuery plugin that depends of your purposes

Can I have some sample please? e.g. execute the function if one of the field is clicked

jQuery(document).on('click', 'your field selector', handlerFunction).

Plenty more you can find in this blog : http://api.jquery.com/on/

hey, it looks than more clean way use this function :

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {

...

});

Try it, this one resolve many problems with dynamic reloading.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,304 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot