davidstutz / bootstrap-multiselect

JQuery multiselect plugin based on Twitter Bootstrap.
https://davidstutz.github.io/bootstrap-multiselect/
Other
3.68k stars 1.98k forks source link

Question: set aria-checked on onChange event #1259

Open karenpayneoregon opened 1 year ago

karenpayneoregon commented 1 year ago

Is there a way to toggle the current option aria-checked attribute in onChange event?

onChange: function (option, checked) {
    var toppings = $('#select-tops-options option:selected');
    var selected = [];
    $(toppings).each(function (index, item) {
        selected.push([$(this).val()]);
        console.log([$(this).val()]);
    });

}

I tried the following which a screen reader does not pick up on and honestly feels wrong.

$(option[0])[0].ariaChecked = checked;

Source file on GitHub