getting value from select list
I know that normally you can get the selected value of a select list by using :selected. But in my scenerio I have a number of rows in my table that are added dynamically and the inputs all have prefixes through which I select them. But once I select them I'm not quite sure how to get to the values of the select list. Here's what I have already and I get undefined for the list value.
var lst = $("input[name^='lst_item_']" , this );
var lstVal = $('#' + lst.attr("id") + ' :selected').val();
alert(lstVal);
If I instead do this I get the correct value but it's not specifying the list to get the value from so I'm afraid that if I have more than 1 select list it might get the value from the wrong list.
var lst = $("input[name^='lst_item_']" , this );
var lstVal = $(' :selected', this).val();
alert(lstVal);