jquery multiselect reload

I was trying to rebuild multiselect by .multiselect("destroy") and .multiselect(), but it wasnt working, so finally I find this solution worked for me.

$.each(jsonArray, function(i, val) {
    $('#frmarticles-f_category_id').append('<option value="'+i+'">'+val+'</option>').multiselect('rebuild');
});

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();

For that one you could just destroy and reinitialize after changing...

$("#multipleselectboxId").append(toAppend).multiselect("destroy").multiselect();

There's also another plugin with a refresh function: EricHynds's Multiselect

$("#multipleselectboxId").append(toAppend).multiselect("refresh");

In my case, I just wanted to replace all previous content of multiselect with new.

This worked for me:

$('#multiselect_id').html(newHtml);
$('#multiselect_id').multiselect('refresh');