jquery 获取多选select的文本中并拼接成字符串

时间:2024-03-08 20:33:25

//拼接产品字符串
var productArray = new Array();
$.each($("#fmeatask-subSystem").find("option:selected"), function(index, obj) {
productArray.push($(obj).text());
});
$.each($("#fmeatask-assembly").find("option:selected"), function(index, obj) {
productArray.push($(obj).text());
});

var productStr=productArray.join(",");