How can I get the value of assignee using AJS.$

Hi All,

Presently I am Using JAVA scripts for getting value of assignee.My objective is to change the assignee based ona field value.

See the present code I am using for that.I wan to convert this using Jquery.

script type="text/javascript">

assignee = document.getElementById('assignee');
source = document.getElementById('customfield_11290');
sourceFieldArea = document.getElementById('customfield_11290').parentNode;
assigneeFieldArea=document.getElementById('assignee').parentNode; = 'none'; = 'none';

if (source.value=="value")





1 answer

0 vote
David Simpson Community Champion Nov 06, 2011

Converting your JavaScript to jQuery, you get something like this:

	$assignee = AJS.$('#assignee');
	$source = AJS.$('#customfield_11290');

	if ($source.val()=='value'){ 
		$assignee.children('option[value="user1"]').attr('selected', 'selected');
} else { $assignee.children('option[value="user2"]').attr('selected', 'selected');
} });

...but there's nothing wrong with pure JavaScript :)

Suggest an answer

Log in or Join to answer
Community showcase
Jason Wong
Published yesterday in Agility Beta

Welcome to agility

Every team in the world is unique, and so   Atlassian believes   that each and every team's best way of working  needs to  be molded to their unique circumstances  – ...

237 views 5 14
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