如何從jquery多選精選按鈕中刪除選定的項目後點擊重置按鈕?刷新jquery多選精選
<select data-placeholder="Select" id="options" class="chosen-select" maxwidth="50px" multiple tabindex="15" ></select>
我已經嘗試了幾種方法,沒有運氣。這是我的代碼:
$("#options").multiselect('refresh');
$("#options").multiselect('clearSelection');
$('#options').multiSelect('deselect_all');
$("#options").find('option:selected').removeAttr("selected");
上面仍然顯示選定的項目,如圖像後,
任何幫助,將不勝感激。
該截圖看起來不像多選 - 它看起來像Chosen( https://harvesthq.github.io/chosen/)或標記(http://aehlke.github.io/tag-it/)...你是否100%確定哪個庫正在使用?編輯:實際上基於類,它是一個選定的字段...使用'.chosen()'方法,或將屬性設置爲false(即'$(「#options」)。find('option:selected') .prop('selected',false)'),而不僅僅是刪除屬性;然後觸發更新:'$(「#options」)。trigger('chosen:updated');' –