Hi All,
I want to search for a name in database using searchbar on homepage and display results on a separate page, I have done this by creating a database, a search bar (using user input text field with an icon) on homepage and a separate page (called results page) which have a repeater element on it.
Now
I am using below code on homepage and a separate code on results page
import {local} from ‘wix-storage’;
import wixLocation from ‘wix-location’;
$w.onReady( function () {
});
export function searchButton_click(event) {
let word = $w(“#searchBar”).value;
local.setItem(“searchWord”, word);
wixLocation.to(‘/results’);
}
I have achieved the results but my concern is the mouse click event.
export function searchButton_click(event)
I want people to get search result when they type the word in search bar and hit enter as currently after typing the word we need to click on search icon and the results are displayed.
I tried adding an event handler on user input field
export function searchBar_keyPress(event)
but this doesn’t give results