Activity Forums Salesforce Questions and Answers Can we fire events on key press in Lightning for Salesforce?

  • shariq

    Member
    July 11, 2017 at 2:08 pm

    Can we fire events on key press in Lightning for Salesforce?

  • Aman

    Member
    July 11, 2017 at 3:57 pm

    Hello shariq,

    UI components provide easy handling of user interface events such as keyboard and mouse interactions. By listening to these events, you can also bind values on UI input components using the updateon attribute, such that the values update when those events are fired.
    Capture a UI event by defining its handler on the component.

  • Parul

    Member
    September 30, 2018 at 8:33 pm

    Hello Shariq,

    Here is a lightning code sample.

    <aura:application >
        <aura:Attribute name=’val’ type = ‘String’ />
        <ui:inputText value='{!v.val}’ keyup=”{!c.search}” />
    </aura:application>
    ({
    search : function(component, event, helper) 
    {
        if(event.getParams().keyCode == 13){
            alert(‘Enter key pressed’); // Do your work here fire the event
        }
    }
    })
Viewing 1 - 3 of 3 posts

Log in to reply.

Original Post
0 of 0 posts June 2018
Now