<td>近期活动</td> <td> <select id="activities" name="activities" data-options="editable:true" style="width:200px;height:30px"> </select> <div id="sp"> <c:forEach items="${prolist }" var="b"> <input type="checkbox" name="activities"value="${b.id}"> <span>${b.name}</span> <br /> </c:forEach> </div> </td> Js部分 $(function() { $(‘#activities‘).combo({ required : true, editable : true, multiple : true }); $(‘#sp‘).appendTo($(‘#activities‘).combo(‘panel‘)); $("#sp input") .click( function() { var _value = ""; var _text = ""; $("[name=activities]:input:checked").each(function() { _value += $(this).val() + ","; _text += $(this).next("span").text() + ","; }); //设置下拉选中值 $(‘#activities‘).combo(‘setValue‘, _value).combo(‘setText‘, _text);}); });
原文:http://www.cnblogs.com/baijin05/p/5040405.html