Activity Forums Salesforce® Discussions How i can get the label of the selected value in lightning-Combobox in LWC?

  • How i can get the label of the selected value in lightning-Combobox in LWC?

    Posted by Shweta on December 30, 2020 at 3:08 pm

    How i can get the label of the selected value in lightning-Combobox in LWC?

    Ritesh replied 2 years, 7 months ago 3 Members · 2 Replies
  • 2 Replies
  • Aditya

    Member
    January 5, 2021 at 6:26 am

    .js File:
    `@track selectedLabel;

    get options() {
    return [
    { label: 'New', value: 'new' },
    { label: 'In Progress', value: 'inProgress' },
    { label: 'Finished', value: 'finished' },
    ];
    }

    handleChange(event) {
    this.selectedLabel = event.target.options.find(opt => opt.value === event.detail.value).label;
    }`

  • Ritesh

    Member
    April 18, 2022 at 11:28 am

    @munna-rkgit42gmail-com This worked. thanks for posting

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos