I've written a listner on a button action which adds dynamic dropdown in my dialog -
name : './groupinfo'+count,id : 'groupinfo'+count,xtype : 'selection',type : 'select',emptyText:'Select a group...',options : '/bin/groupinfo/options.json' ,fieldLabel : 'Group',width:200
options.json sends info in the folloing pattern - [{"text":"Value1","value":"val1"},{"text":"Value2","value":"val2"},{"text":"Value3","value":"val3"}] and dropdown values are showing properly.
Now I want to read the selected value in my js file. So, I have written like below but the value is coming as undefined-
var dropdownVal = document.getElementById("groupinfo"+i).value;
Now, I have tried this which gives me blank value when I select -
var value1 = $('#groupinfo'+i+' option:selected').text(); alert(value1);var value2 = $('#groupinfo'+i).val(); alert(value2);
When I tried to get the value from dynamically created text box then I can get the value by using getElementById().value but it is not working for dynamically created dropdown. Please advice!