Onselect remove item from Bootstrap Multiselect dropdown
2 answers
Modify your document. Before
$(document).ready(function() {
$('.multi2').multiselect({ // this is the second multiselect
includeSelectAllOption: false,
nonSelectedText: 'Select Teams',
});
$('.multi1').multiselect({ // this is the first multiselect
includeSelectAllOption: false,
nonSelectedText: 'Select Teams',
onChange: function(option, checked, select) { // implement onChange listener
// clear all selection of the second dropdown - This will be called whenever there a change in the first multiselect
// You can think of puting in some additional conditions here.
$('.multi2').multiselect('clearSelection', false);
}
});
});
You will also need to update the html as -
<select id="team0" name="team0[]" class="multi1" multiple="multiple"><!-- first dropdown-->
and
<select id="team1" name="team0[]" class="multi2" multiple="multiple"><!-- second dropdown-->
<iframe width="100%" height="300" src="//jsfiddle.net/yellen/fw32gwd2/embedded/" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
Additional links: http://davidstutz.github.io/bootstrap-multiselect/#methods
0
source to share