How we can read the lightning-combobox key value, In the below i can able to read the value by event.detail.value
How we can read the label value, tried event.detail.label
it's Undefined.
get options() {
return [
{ label: '1', value: 'new' },
{ label: '2', value: 'inProgress' },
{ label: '3', value: 'finished' },
];
}
<template>
<lightning-combobox
name="progress"
label="Status"
value={value}
placeholder="Select Progress"
options={options}
onchange={handleChange} ></lightning-combobox>
<p>Selected value is: {value}</p>
</template>
import { LightningElement } from 'lwc';
export default class ComboboxBasic extends LightningElement {
value = 'inProgress';
get options() {
return [
{ label: '1', value: 'new' },
{ label: '2', value: 'inProgress' },
{ label: '3', value: 'finished' },
];
}
handleChange(event) {
this.value = event.detail.value;
console.log(event.detail.value);
console.log(event.detail.label);
}
}