I'm trying to get the value from a lightning:select but when I try a console.log in the js controller of the component, it doesn't show anything.
I put the same function exactly in 'Inspect Element > Console' and it works perfectly.
Component:
<lightning:select name="{!'mySelectedStatus' + case.CaseNumber}">
<option text="All" value="" selected="true"/>
<aura:iteration items="{!v.caseStatuses}" var="status">
<option text="{!status}" value="{!status}" />
</aura:iteration>
</lightning:select>
Controller.js:
changeStatus : function(component, event, helper) {
var csNum = event.getSource().get("v.name");
console.log(document.getElementsByName("mySelectedStatus00001044")[0].value); //Fails Here
var status = document.getElementsByName("mySelectedStatus"+csNum)[0].value;
helper.changeStatus(component, csNum, status);
}
In the Inspect Element Console I get the result: document.getElementsByName("mySelectedStatus00001044")[0].value); Result => "New"
But in controller.js console.log() I get blank. Why?