SelectControl


Use this control to create and manipulate selects. This control uses the EventControl to notify subscribers when the select is changed.

Inherits properties from its parent, InputControl.

Initialize

Initialize the control.

const selectElement = ElementResolver.resolveOne('#someSelect');

const exampleSelect = new SelectControl(selectElement);

exampleSelect.initialize();

.addOption(label, value, selected = false)

Add an option to the select element.

examleSelect.addOption('Option label', 'value');

.addEmptyOption()

Add an empty option to the select element.

.removeAllOptions()

Remove all options from the select element.

.value

Get the value of the select.

.changeEvent.subscribe()

Subscribe to the select' change event. See Event Control.