仅选择选择了至少一个选项的选择框?

时间:2019-04-16 00:35:25

标签: javascript jquery

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
});

0 个答案:

没有答案