how to pass the index values from lightning:select to javascript onchange event occurs. please help anyone

                                    <!--lightning:input variant="label-hidden" class="slds-align_absolute-center" disabled="true" name="Name" type="text"    value="{!set.field}" /-->
                                    <a style="color:black"   >
                                        <!--lightning:combobox aura:id="select_Field" name="FieldReference" label="FieldReference" placeholder="Choose any Field" variant="label-hidden" value="{!set.field}" options="{! v.headerOptions }" /-->
                                        <lightning:select   class="label-hidden" value="{!set.field}" data-id="{!masterindex}" data-value="{!childindex}" onchange="{!c.onHeaderChange}" >
                                             <option text="Select any value" value=""/>
                                            <aura:iteration items="{!v.headerOptions}" var="Option">
                                                <option text="{!Option.label}" value="{!Option.value}"/>

  • you mean selected value? if yes you want get option.label or Option.value?
    – sdandamud1
    Commented Dec 5, 2019 at 13:13

1 Answer 1


use the option of selectedValue for lightning select.

  <lightning:select name="colorId" label="Select a color:" aura:id="colorId" value="{!v.selectedValue}">
        <aura:iteration items="{!v.options}" var="option">
            <option text="{!option.label}" value="{!option.id}" selected="{!option.selected}"/>

the selectedValue holds the value selected from lightning select.

  • In the method, onHeaderChange, call the selected value using, component.get('v.selectedValue');
    – Ankur ---
    Commented Dec 5, 2019 at 6:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .