0

I have a <lightning:input which is used to search for products.

CMP

<lightning:input onchange="{!c.handleSearchTermChange}" aura:id="searchTerm" label="Search Products" type="search" />

JavaScript Controller

handleSearchTermChange: function (cmp, event, helper) {
    let searchTerm = cmp.find("searchTerm").get("v.value");
    if (searchTerm != null && searchTerm.length > 1) {
        helper.searchProducts(cmp);
    } else {
        cmp.set("v.results", null);
    }
    if (event.keyCode === 13) {
        // what should I do here to hide the mobile device keyboard?
    }
},

I would like the mobile device keyboard to hide once the user presses Enter

How would I achieve this?

Your Answer

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

Browse other questions tagged or ask your own question.