red*_*are 47
这应该让你开始.请注意,我将单元格内容用于选项的值和文本.您可能需要更改此内容,但问题尚不清楚.
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() );
Run Code Online (Sandbox Code Playgroud)