how to set selected option in jquery multiselect

571 views Asked by At

I use jquery multiselect. I want set option selected but when I write selected="selected" attribute into option then multiselect doesn't run correctly. For example when two option is selected then I deselect this option after this the number of selected doesnt decrease. I use Control 6: With callback in this demo.

My javascript:

$(document).ready( function() {
  $("#identificationMethods").multiSelect( null, function(el) {
    ...
  });
});

My 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>
0

There are 0 answers