<select multiselect id="foo">
<optgroup value="bar">BAZ</optgroup>
<optgroup value="x">y</optgroup>
<optgroup value="a">b</optgroup>
</select>
What I want to write is something like this:
$('#foo').multiselect('checkAll', {optgroupNum=0}); // checks all options under "BAZ"
Nice to have:
$('#foo').multiselect('uncheckAll', {optgroupValue="x"}); // unchecks all options under "y"
$('#foo').multiselect('disable', {optgroupText="b"}); // checks all options under "b"
Code I currently have to write:
$($('#foo').multiselect('widget').find('li.ui-multiselect-optgroup-label')[0]).nextUntil('.ui-multiselect-optgroup-label').find(':checkbox').each(function(i, e) {
if ($(this).attr('aria-selected')) {
this.click();
}
});