Select Events

The Select Events API of Better-Nice-Select


 

Events can currently be bound only in one way:

let select = document.queryselector("#my-selector");
let componentInit = new betterNiceSelect.BetterNiceSelect('#my-selector');

select.addEventListener("event-name.better-nice-select", function(e, arg1,arg2, ...){
    // do something...
});

 

 

Inserted

  • Event: inserted.better-nice-select
  • Parameter:
Key Description
e.detail.key The key or rather the setted value for the <option> element which is added.
e.detail.value The value or rather the setted innerText for the <option> element which is added.

 

  • Detail: The event is fired immediately after a new option will be added to the <select> field.
  • Example: Inserted

 

 

Removed

  • Event: removed.better-nice-select
  • Parameter:
Key Description
e.detail.key The key or rather the setted value for the <option> element which is removed.
e.detail.value The value or rather the setted innerText for the <option> element which is removed.

 

  • Detail: The event is fired immediately after an option will be removed from the <select> field.
  • Example: Removed