我使用 jquery 多选。我想选择设置选项,但是当我将selected="selected"属性写入选项时,多选无法正确运行。For example when two option is selected then I deselect this option after this the number of selected doesnt decrease. 我在这个演示中使用Control 6: With callback。
我的JavaScript:
$(document).ready( function() {
$("#identificationMethods").multiSelect( null, function(el) {
...
});
});
我的 HTML
<select id="identificationMethods" name="identificationMethods[]" multiple="multiple" style="width: 100px;">
<c:forEach items="${identificationMethodICs}" var="im">
<option <c:if test="${im.selected == true}">selected="selected"</c:if> value="${im.subType}">
${im.subType}
</option>
</c:forEach>
</select>