The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript Help Needed

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 31, 2013

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Florin Manaila
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 31, 2013

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.

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 31, 2013

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?

Florin Manaila
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 31, 2013

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.

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 31, 2013

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

Any idea?

Florin Manaila
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 31, 2013

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

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 31, 2013

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

Any input from your side??

TAGS
AUG Leaders

Atlassian Community Events