bluzky / nice-select2

A lightweight vanilla javascript library that replaces native select elements with customizable dropdowns
https://bluzky.github.io/nice-select2/
MIT License
370 stars 61 forks source link

Callback after selecting option #87

Open MrMooky opened 3 months ago

MrMooky commented 3 months ago

I read the docs and also some issues, but I was not able to find any way to trigger a callback after selecting an option. Is there no option, or have I somehow missed that?

I was thinking of something like that:

var options = {searchable: true};

var select = NiceSelect.bind(document.getElementById("countryselect"), options, function(value) {
    @this.set('fields.country', value);
});