It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

In issue edit screen, unable to get updated value of customfield using javascript.


I have added below javascript on textbox custom field's description.

setInterval(function(){console.log('value is:'+AJS.$("#customfield_11426\\:input1").val());  //unable to get updated value on each interval tick, it just prints initial value which is found while loading edit issue screen.

It executes on 2 sec but it just print same value of input1 textbox instead of updated values.

(just take the value which is found while loading issue edit screen but unable to get updated textbox values).

i need these updated value for further calculation.

Can you tell me what can be the cause and how to resolve .

Thank You

3 answers

try with 		
$('#customfield_11426').change(function() {  
  var val = $('#customfield_11426').val();



your code will execute on page load, to get latest value of the field you have to place your code inside some event

something like follows

$('#customfield_11426').bind('keypress', function (e) {
  //add your code here      

I have replaced and how it works -

when update the textbox valut to '157' then console.log prints '15' for AJS.$(this).val() and not 7. when give value - 1578 then shows 157. so, last char not cosndering and also, when do backspace to remove char then also it does not update value. any other event have to cosnider..?

also, when i show in "firebug" then it inspect the value as same value which is on loading the screen and no updated value.

Hi @dhaval soni ,

Change event will work correctly, where keypress, keydown,keyup are all keyboard events which will have some syncing issues, whatever you have discussed earlier is an keyboard value syncing issue,blur can also be used but when the field loses it's focus only - blur event will be called, Change is the correct event, whenever a value changes, this event will be called.So, Change event will work correctly for you.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Next-gen

Keyboard shortcuts have arrived for next-gen projects!

...ollected feedback from users around the lack of shortcuts, and we’re here to address that: In next-gen projects, I miss the keyboard shortcuts badly. This is particularly true on the Board, but also i...

278 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you