2

I used this to create search input:

<ui:inputText aura:id="search" label="" placeholder="Search By Name"
                  class="slds-input inputClass"
                  labelClass="slds-form-element__label"
                  value="" change="{!c.searchChange}" updateOn="keyup"
                  required="false"/>

the problem is that searchChange function is fired only after press Enter I want it to be fired while writing( while content is changing ) please help

2 Answers 2

1

Use Keyup instead of change .by using keyup event is fired whenever you releases keyboard key

<ui:inputText aura:id="search" label="" placeholder="Search By Name"
                  class="slds-input inputClass"
                  labelClass="slds-form-element__label"
                  value="" keyup="{!c.searchChange}" updateOn="keyup"
                  required="false"/>
2
  • I tried but same, it fired only on enter
    – sundus
    Jun 30, 2017 at 11:58
  • change the edited code in your question @sundus
    – vignesh
    Jun 30, 2017 at 12:01
0

Use KeyUp but inside in the div tag, I using it, and it works just fine:

<div onkeyup="{! c.handleSearchContact }">
<lightning:input
    aura:id="contactNameSearch"
    label="Search Contact"
    isLoading="{! v.issearching }"
    type="search"
    onclick="{!c.clearContactDataTable}"
/>

The "handleSearchContact" method is to handle the keyup. And the "clearContactDataTable" method, it when clicking on (x).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.