onchange
Description
Fires when a new value is selected in the controlUsage
onchange?: (ev: { value: string | number }) => void;
Parameters
The callback of the event takes an object with the following parameter:
- value - (required) an id of the newly selected option or "" if the value is cleared
Example
<script>
function handleChange({value}) {
console.log(value);
// id of a new selected option
}
</script>
<Select options={dataset} onchange={handleChange}/>
Details
The handler function receives an object with an id of the newly selected option.
Related article: Catching the change of selected option