Wikipedia Viewer - search on pressing Enter

I am trying to see that when a user after typing his search keyword presses Enter, the search results should load. I have tried but it doesn’t seem to work.

Can you help me out here?

Because you are using a form, you need to prevent the form from submitting (which is the default behavior when a button is clicked in your case). To do that, try adding a parameter called event (it does not matter the name) to the click callback function. This event variable will contain the event information of the click. Then inside the callback function, just add event.preventDefault(); at the top of the function (as below):

  $("#search-button").on("click", function(event) {

Also, the following is not doing what you want, because there is no element with id=“search-in”. However, you do have an input element with id=“search-input”.

window.onload = function() {