Javascript does not reload on JIRA 5


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.


2 answers

1 accepted

0 votes
Accepted answer

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 :

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
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,047 views 4 9
Read article

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