div
不起作用,如果选择了多个选项,这将为我提供同一选择框的多个实例:var $rows = $('select:selected');
var $rows = $('select option:selected');
var $rows = $('select option:selected');
$rows.each(function() {
console.log($(this).closest('select').attr('id')); // should only return 1 and 2, not 2 twice
});