I am using this multiselect plugin with 2 dropdowns with these ids: #Countries & #Cities.
When the page loads, both dropdowns are populated with data and every option is checked:
$('#Countries').multiselect('checkAll');
$('#Cities').multiselect('checkAll');
When I click the 'check all' link after clicking 'uncheck all' in the #Countries dropdown, I want:
I tried this in JavaScript:
$('#Countries').multiselect({
checkall: function(event, ui){
$('#Cities').multiselect('checkAll');
$('#Cities').multiselect('refresh');
}
});
What am i missing?
Try this,
$("#City").multiselect();
$("#Country").multiselect({
header: true,
checkAll: function(){
$("#City").multiselect("widget").find('.ui-multiselect-all').click()
},
uncheckAll: function(){
$("#City").multiselect("widget").find('.ui-multiselect-none').click()
},
});
$("#Country").multiselect("widget").find('.ui-multiselect-all').click()
$("#City").multiselect("widget").find('.ui-multiselect-all').click()