logo

/Select Box|v1.1.0

Typedef

CustomEvents:

class

selectBox.jsline 145

SelectBox provides some custom events: (open, close, disable, enable, change).
You can bind event handlers by selectBox.on(eventName, handler) and unbind by selectBox.off(eventName, handler).
Refer to the CustomEvents document at tui-code-snippet to know how to bind, and unbind custom events.
The example using custom events can be found here.

EXAMPLES
// bind 'change' event
selectBox.on('change', ev => {
  console.log(`selected item is changed from ${ev.prev.getLabel()} to ${ev.curr.getLabel()}.`);
});

// bind 'disable' and enable event
const print = ev => {
  let target = '';
  if (ev.target instanceof SelectBox) {
    target = 'Select box';
  } else {
    target = ev.target.getLabel();
  }
  console.log(`${target} is ${ev.type}.`);
}
selectBox.on({
  disable: print,
  enable: print
});

// unbind change event
selectBox.off('change');

// unbind disable event
selectBox.off(disable, print);

// unbind all events
selectBox.off();
Resizable