updateSelectValue multiple issue
Opened this issue · 2 comments
afonja14755 commented
When user check and uncheck item, in native select, option doesn't remove attribute selected=true.
You can fix it by:
var select = this.el;
select.querySelectorAll("option").forEach(function (item) {
item.removeAttribute("selected");
});
this.selectedOptions.forEach(function(item) {
var el = select.querySelector(`option[value="${item.data.value}"]`);
if (el){
//Change it, cause it works more correctly.
el.setAttribute("selected", "selected");
el.selected = true;
}
});
Or some better solution with indexOf, filter.
gpham99 commented
+1 on this. This would be so nice
afonja14755 commented
+1 on this. This would be so nice
If you are looking for a new and supported library for selectors in native JavaScript, I can recommend you my own, which I am following.