Wikipedia viewer js not working

I am working on Wikipedia viewer but when I enter a term in the search box I do not get the results. I just get a blank page. Can someone please help figure out what is wrong with my js code?

thank you,

You have two choices

#1) Since you are not using the form to submit to another webpage, you can delete the <form> and </form> tags and your code will work. Why? I will answer that below with the other suggestion.

#2) When using the form element a button with type=“submit”, when the button is clicked is attempts to submit the form to another page. The other page is specified with the action attribute. Since you do not have an action attribute, it assumes you want to load the same page. You can prevent this by either removing the type=“submit” or to be completely safe with other browsers, you can add call preventDefault method on the event object which available via the click callback function. You would need to add an argument (let’s call it event) to the callback function and then call the preventDefault method on it like below:

$("#search").click(function( event ){
  var search = $('#search').val();
1 Like