Robin Michael Poothurai Robin Michael Poothurai - 28 days ago 19
jQuery Question

jquery multiselect reload

How can I add or remove options in JQuery UI Multiselect ? I am initializing the multiselect on page load and I need to remove existing values and add new values based on another selection. I am initializing the multiselect on page load using:

$("#multipleselectboxId").multiselect();


After that, I am adding values to the multiple drop down using jQuery
append()
and
remove()
methods which are working fine with original dropdown but in the multiselect are not getting reflected.

Can anyone help with this?

Answer

I found the solution for this, first destroy the multiselect and reInitialize it, Thanks for @ Brandon Joyce,

solutions for this is

$("#multipleselectboxId").append(toAppend);
$("#multipleselectboxId").remove(toRemove);

$("#multipleselectboxId").multiselect('destroy');
$("#multipleselectboxId").multiselect();