come_from = come_from.split(",");
<pre name="code" class="html">var options = document.getElementById("come_from").options;
var str='<select id="come_from" name="come_from" multiple="multiple" style="width:380px;">';
for (var i = 0; i < options.length; i++) {
if($.inArray(options[i].value, come_from) != -1){
alert(options[i].value)
str+="<option value="+options[i].value+" selected>"+options[i].value+"</option>";
}else{
str +="<option value"+options[i].value+" >"+options[i].value+"</option>";
}
}
str+="</select>";
$("#td_come_from").html(str);
$("#come_from").multiselect({selectedList: 2,noneSelectedText: 'Select come_from'}).multiselectfilter();
核心:只能先清空。