I am using Lightning button and on the click of the button I am calling a method in JS controller. I followed the below article to identify the button name but unsuccessful. The moment I start typing in value on the field it pops up the error.
Component bundle version : 40.0
<div aura:id="lookup" class="slds-show">
<input class="slds-input" type="text" aria-haspopup="true" aria-autocomplete="list" role="combobox" aria-expanded="true" aria-activedescendant="" aria-owns="companyList" value="{!v.searchString}" updateOn="keyup" onkeyup="{!c.runSearch}" placeholder="Search Companies..."/>
<p>You clicked: {!v.whichButton}</p>
<lightning:button aura:id="lookupbutton" class="slds-button slds-input__icon slds-text-color--default" iconName="utility:search" variant="base" onclick="{!c.runSearch}" value="{!v.searchString}" />
</div>
Here is my JS controller:
runSearch : function(component, event, helper) {
// if(event.keyCode == 13 || event.which == 13){ //Enter key
var whichOne = event.getSource().getLocalId();
console.log(whichOne);
component.set("v.whichButton", whichOne);
var searchString = event.target.value;
component.set("v.searchString", searchString);
component.set("v.SECompanies", null);
console.log(searchString);
helper.runSearchHelper(component);
// }
}