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 anothe
var valArr = ["1", "2"],
i = 0,
size = valArr.length,
$options = $('#MySelect option');
for (i; i < size; i++) {
$options.filter('[value="' + valArr[i] + '"]').prop('selected', true);
}
$('#MySelect').multiselect('reload');
1.valArr is values of select Options
2.for loop to set selected to matched option based on valArr
3.our changes is only in hidden select element
4.to change in multiselect generated elements we need to reload
5.every pluggin may have different name to reload eg:update,refresh