On my website, I have added a Bootstrap multi-select. While I was trying to add the option dynamically by jQuery AJAX but it not working properly. Before add new options I want to remove the option past option and rebuild new options.
My Code:
$("#room_id").multiselect("refresh"); for(i=0; i<res.data.length; i++){ $("#room_id").append('<option value="'+res.data[i]['room_id']+'">'+res.data[i]['room_name']+'</option>'); }
I have tried with refresh but it not working.
$('#room_id').multiselect('refresh');
I have tried with destroy, got same issue not working
$('#room_id').multiselect('destroy');
Question and answer is powered by AnsPress.io