I have a column with id “tdcities” I need to check through all the select elements in this particular table column compare their id with the row id and if they match, select the text value.
Here is the code I am using
$("#tdcities input[type=select]").each(function(){
var city_id=$(this).attr('id');
if(city_id==tr_id){
country_city = $(this).text();
alert(country_city)
}
});
This code works perfectly for input type of text(just replace the .text part with .val) but not for select\option types of input menu
All help appreciated
country_city = $(this).children('option:selected').text();