nice-select2 icon indicating copy to clipboard operation
nice-select2 copied to clipboard

updateSelectValue multiple issue

Open afonja14755 opened this issue 2 years ago • 2 comments

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.

afonja14755 avatar Jul 10 '23 10:07 afonja14755

+1 on this. This would be so nice

gpham99 avatar Mar 28 '24 21:03 gpham99

+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.

afonja14755 avatar Apr 09 '24 17:04 afonja14755