Unable to load my javascript on Greenhopper New Card page


I wrote some javascript as follow

(function($) {
        // old function
    JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
		var tex1=AJS.$("#newField_customfield_12051");
		var tex2 =  AJS.$("#customfield_12051");
		if(tex1 == null){
			alert("Inside 1");
		else {
			alert("In 2");
		var t1 = AJS.$("#customfield_12051-field").length;
		alert (t1);

none of the alert windows appeared when I click on New Card button in Greenhopper board.

I loaded script as web-resource module and placed as

<web-resource key="hide_nda_programs" name="HideNDAPrograms">
        <resource type="download" name="HideNDAPrograms.js" location="/js/HideNDAPrograms.js"/>

Am I right in case of JIRA.bind etc., even in Greenhopper scenario

1 answer

Hi Bharadwaj,

I had the same problem. After some investigation, I figured out the issue. My Javascript took place while page is loading.

I fixed this problem just adding a timeout as follow :

jQuery(document).ready(function() {

function myfunction(){

Hope this helps.


Any news? Did the suggested approach resolve your issue?

Let me know and , if yes, accept my answer.



Suggest an answer

Log in or Join to answer
Community showcase
Alexey Matveev
Published Saturday in Jira

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10. I prefer to use Jira in a docker container because: 1. I can install Jira with a couple of commands. 2. I can start and stop Jira just by starting and s...

106 views 2 5
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
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