How to create Search box with 2 different triggers

I currently have a search box that is triggered when you press enter. I would like to have a second option of triggering it when you press the search button, so you can either press enter or press the button. My knowledge of code is pretty limited so I need it to be really simple.
All help appreciated.
This is my current code:
import { local } from ‘wix-storage’ ;

import wixLocation from ‘wix-location’ ;

$w . onReady ( function () {

});
export function searchbox_keyPress ( event , $w ) {
if ( event . key === “Enter” ){
console . log ( “Enter was pressed!” )

**let**  word  =  $w ( "#searchbox" ). value ; 

local . setItem ( "searchWord" ,  word ); 

wixLocation . to ( `/results-1` ); 

}

//imports....
function search(){
let word = $w("#searchbox").value;
    local.setItem("searchWord", word);
    wixLocation.to(`/results-1`);
}
 $w.onReady(function () {
$w('#serchButton').onClick(search);
});
export function searchbox_keyPress(event) {
 if(event.key === "Enter"){
	search();
}
}

Awesome! That worked! I tried so many different things, but I kept getting something wrong (as it happens when you don’t really understand the code you are writing).

You’re welcome.
You may want to consider storing the search term in the memory (import {memory} from ‘wix-storage’; etc…) or pass it via the URL query parameters (I think it should be a little bit faster than local storage. But maybe it’s negligible).

how would I do that? The search is pretty fast, so it probably doesn’t matter, but always looking to improve

Same, but:
Page1:

import {memory} from 'wix-storage';
//...
memory.setItem("searchWord", word);

Page2:

import {memory} from 'wix-storage';
//...
const searchWord = memory.getItem("searchWord");

the 2nd part is on the results page?

Yes

Great! thanks for the help