Your search button is an anchor tag
<a>, which will send the browser to a new location by default. I wouldn’t suggest using anchor tags in this way, but since we’re here, you can override the default behavior. Every event handler gets passed an
event object, and that object has a method,
preventDefault, which will prevent the default behavior of the event. Who would have guessed, am I right?
So, simplest fix:
// Do other stuff
There’s a similar problem when it comes to the
<form> tag, which responds to pressing the enter key by submitting data. You could fix this is much the same way as the anchor tag, but I think it’d be better if you just replaced the
<form> with a
<div> for now.