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

This widget could not be displayed.

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/

This widget could not be displayed.

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 Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

269 views 5 0
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