JQuery script to clear field worked in JIRA 4 but does not in 6

The script empties Assignee if another field changes, in this case the custom field Location

<script type="text/javascript">

jQuery(document).ready(function() {

var location_fld = document.getElementById("customfield_10505");

var assignee_fld = document.getElementById("assignee");

location_fld.onchange = function(){

assignee_fld.value = "";




I am a novice at modifing JIRA with scripts so please don't provide me a geeky response that I can't follow. This is a new copy of JIRA on a new server, not an upgrade, so maybe a missing plugin or configuration is at fault.

4 answers

0 vote
Eddie Webb Community Champion Aug 14, 2013

If you are modifying JIRA templates to insert your own scripts, you may need to encounter "geeky" answers...

Instead of using jquery, use AJS, atlassian's wrapper.

AJS.$(document).ready(function() {

Second, use the page source view (ctrl+U in chrome) to verify that the IDs are both still valid.

I'm afraid I'm on a timelime and JIRA is not my normal responsibility. I don't have the time to learn AJS, when I finish this project I will probably not use JIRA for some time as my job is Unix/Linux support.

your code also seems correct but you have to include that in following event

JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
//your logic here

you can try with following code

&lt;script type="text/javascript"&gt;  
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
function clearAssignee(){
	$('#customfield_10505').change(function() {	


the bind event is used here to execute the JavaScript on popup's(ex. create issue, transition, edit issue popup's ).

yes, it should be added in description of custom field in field configuration

I had seen the JIRA.bind... on responses to other questions but did not know what it was for. Anyway I applied it but the problem remains. Do these scripts still go in the description field?

The code was breaking the maintenance page for Custom Fields so I removed it. I will need to readdress this later when I have the time. Thanks for your help.

Is there a good reference document to learn these things?

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,198 views 13 19
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