Javascript Help Needed

When using javascript in custom field to display red, initially it is black and after sometime, it's become red.

It should be red initially , rather than black.

Any idea?

Here is my code.

<script type='text/javascript'>
AJS.$(document).ready(function() {
AJS.$("#customfield_113").css("color", "red");
}
);

1 answer

1 accepted

This widget could not be displayed.

That's the downside of using javascript. You have to wait for the resources to be loaded and executed. In your case, i think it would be easier to just put that in a stylesheet if there are no other conditions to check.

Hi Florin

Here is my complete code!!

Suggest appropriate methods are highly welcome

<script type="text/javascript">
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
callFunction();
});
callFunction();
function callFunction(){
AJS.$("#customfield_113").css("color", "red");
AJS.$("#rowForcustomfield_113").addClass("item item-right");

}
</script>

Can we write in separate file?

I believe you can put color : red in a stylesheed included by your plugin. The classes however cannot, unless that customfield is built in-house.

They are custom field. I want to view that field in right hand side as well.

Any idea?

I belive that script is as good as it can get.

The only issue is - initially shown in left hand side and then right.

Any input from your side??

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...

155 views 2 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