'Is there any way to catch keypress events in mobile browser keyboard?

I built a filter functionality for a list of banks. It works fine in desktop: When the user puts in any name, the keypress event occurs and later it call the filter() function.

However, it does not work on mobile, since no keypress event is triggered.

The goal is whenever user put any letter in input filed, it should call that filter() function on mobile. Is there any way to do this?

(this website is built on wix so it use its velo api)

let debounceTimer;

export function search_keyPress(event) { //enable onKeypress for input form , search is the id of input

$w("#clearSearch").show(); //show the cross mark to clear inputs

$w("#search").value; // value of input field

    if (debounceTimer) {
        clearTimeout(debounceTimer);
        debounceTimer = undefined;
    }

    debounceTimer = setTimeout(() => {
        filter($w("#search").value); //ID of input form
    }, 200);
}

let searchWord;

function filter(search) {
    if (searchWord !== search) {
        $w("#bankTableDataset").setFilter(wixData.filter().contains('bankName', search)); // ID of the dataset
        searchWord = search;
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source