I want to write JQuery code that will uncheck and deselect some options from Bootstrap Multi select.
For example if the multi-select is has following values selected & checked:
I want a JQuery that will output the following
I did the following JQuery which didn't work:
$('#example-optionClass').val('1').prop('checked', flase);
$('#example-optionClass').val('4').prop('checked', flase);
$('#example-optionClass').val('2').prop('checked', true);
$('#example-optionClass').val('6').prop('checked', true);
Here the the Source code:
Please help.thanks
In MultiSelect to select options you need to use
$('#example-optionClass').multiselect('select', ['2', '6']);
This is saying select the options '2' and '6' from example-optionClass.
And to unselect options you need to use
$('#example-optionClass').multiselect('deselect', ['1', '4']);
This is saying unselect the options '1' and '4' from example-optionClass
If you go to The Methods you will see all the JavaScript methods available to you, it explains how to use the 2 above functions in more detail.
Hope this helps