I'm using bootstrap-multiselect for a dropdown in my application. Everything works fine except for my form reset, when I want it to revert back to the originally selected values. It's displaying the selected values as expected in the menu when it's closed (i.e. creating a list with multiple selections), but when I open the menu the checkboxes for the selected items aren't checked.
I've tried the following to no avail:
$("#MyMenu").multiselect('refresh');
$("#MyMenu").multiselect('rebuild');
$("#MyMenu").multiselect('destroy');
followed by
$("#MyMenu").multiselect();
Any help is appreciated!
For me it works simply with:
$('#id').multiselect('refresh');
However, it must be noted that the reset event fires before the form inputs are actually reset. Practically speaking, this means that the following won't work:
$('#formID').on('reset', function(){
$('#id').multiselect('refresh');
});
while wrapping the call inside of an instantaneous setTimeout will work!
$('#formID').on('reset', function(){
setTimeout(function(){
$('#id').multiselect('refresh');
});
});
today i faced same issue...i did
$("option:selected").removeAttr("selected");
$("#MyMenu").multiselect('refresh');
It worked for me...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With