Making custom field text red?

How to make custom field text red?

<script type="text/javascript">
AJS.$("#customfield_11329").attr('style', 'color:red')
</script>

Above code does not work. Any ideas?

2 answers

1 accepted

In that way it does't work on 5+ jira version, try with this

&lt;script type="text/javascript"&gt;
jQuery(document).ready(function($) {
	JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {		
		callFunction();
	});
		callFunction();
	function callFunction(){  		AJS.$('label[for=customfield_11329]').css({color:'red'});
	}
});
&lt;/script&gt;

Great. It works!!

But only in edit screen, not in view screen.

glad to hear it worked!!

if it to be work on view screen you need to check custom field id on view screen

if my answer helped then vote up and accept as answerd :)

try with this

AJS.$('label[for=customfield_11329]').css({'color':'red'});
or
AJS.$("#customfield_11329").parent('label').css('color','red');


Does not work!!!

<script type="text/javascript">
AJS.$("#customfield_11329").parent('label').css('color','red');
</script>

how you tried and whatis the jira version?

can you share your code? i tried now it is working

It is 5.1.5 version,

Still not working

@Rambanam Prasad In which file do I need to edit this?

@Joe Moreno you no need to edit any files, just add code in accepted Answer in Announcement banner for testing, once it worked as expected then i suggest to add this code as web resource module in a plugin(you will get lot of post on this forum if you need to know how to add it in plugin) Note: don't forgot to change customfield id :)

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,307 views 14 20
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
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