$('#mytable tr').each(function() {
var customerId = $(this).find("td").eq(2).html();
});
var items=[], options=[];
//Iterate all td's in second column
$('#tableId>tbody>tr>td:nth-child(2)').each( function(){
//add item to array
items.push( $(this).text() );
});
//restrict array to unique items
var items = $.unique( items );
//iterate unique array and build array of select options
$.each( items, function(i, item){
options.push('<option value="' + item + '">' + item + '</option>');
})
//finally empty the select and append the items from the array
$('#selectId').empty().append( options.join() );
jquery read table
最新推荐文章于 2025-09-06 08:01:57 发布
