I am able to perform multiple searches after the first. You may not think you are, because your current code just keeps appending to the last search results. Scroll down the page after performing multiple search and you will see for yourself.
I do not see any code with an event listener looking for the enter key to be pressed.
The issue is that you are using a form element, which is not need for this project. If you remove the form element and it’s closing tag, but keep the other elements that were nested in it, then you code would “almost” work. I say “almost”, because you need to add () to the end of searchWiki to actually execute the function.
Why is the form element an issue? Because form elements use the action attribute to open a new page. If the action attribute is missing or is set to “” (which yours is), the default page to open is the current page. That is why the page appears to flicker and not do anything. If you want to leave the form element in your code, then you will need to detect the Enter key a slightly different way. Instead of listening for the keyup event, your code needs to listen for the keydown event and then check if event.key is equal to “Enter”. If it is, then you must use event.preventDefault() to prevent the form from submitting and then call searchWiki.
You are super. I did it thanks to your help. I could tell that was the reason but wasn’t sure what to do about it or where to put it. Learned a lot in the last 30 minutes (struggling with a problem is painful but great). Thank you.