0

In my scenario, I want to fetch the label of the menu-item which is clicked.

<lightning-button-menu alternative-text="Options" key={acc.Id} onselect={handleOnselect}>
        <lightning-menu-item label="Edit" value="Val1">
        </lightning-menu-item>
        <lightning-menu-item label="Delete" value="Val2">
        </lightning-menu-item>
 </lightning-button-menu>

In JS:

handleOnselect(event) {
    // This prints the value correctly
    alert('---Print value' + event.detail.value); 
    // This prints undefined
    alert('---Print Label' + event.detail.label); 
}

Is there anyway to get the label of the clicked menu item?

0