Wikipedia Viewer - can't do another search

Hi. Really enjoying these projects but I’ve got an issue on the wikipedia viewer I decided to use JS for this and am able to get search results but have 2 issues.

  1. I cannot do another search after the first.
  2. Can’t search by pressing ‘enter’.

This is my first post so I am not sure how to show the code here but here is the link :slight_smile:

ah. cheers. i do see that now although not entirely sure how to fix it.

I had an event listener listening for keydown but that didn’t quite work . Is there an event listener for the enter button?

thank you

1 Like

I’ve added an event listener now and am able to console.log “hello” on enter, however i’m still unable to call the searchWiki function.

thnk you so much. I tried both and they both work well. I had a feeling it was something in my form.

I do still have one other issue in that while I can do multiple searches after another, each serch is appended to the old. I can fix this by clearing the results like this

results.innerHTML = " ";
results.insertAdjacentHTML(“beforeend”, item);

however then I am only getting one search result instead of the 5 I want.

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.