How to get the value of dropdown list generated dynamically
Hello,
First row of input fields are manually put in html
the rest of the rows are generated dynamically by clicking add options
(the values of the combox box is also coming from database through ajax from second row onwards)
When I select the first row combo box - I am able to get the values of selected item and its price is fetched through ajax call and inserted into the nex text box.
My problem is that when I select the second, third etc row's combo box I am not able to generate the values of the selected item
The code I am using is :
$('[id^=item_id]').on('change',function(){
// I have also tried $('[id^=item_id]').'change(function(){
var role=$(this).val();
var element_id=$(this).attr("id");
var eid=element_id.substr(7);
$.post('get_price.php',{item_id:role},function(data){
$('#price'+eid).val(data);
});
});
Please help me with this.
Thanks