Build a Wikipedia Viewer help

Code https://codepen.io/MarcelPenn/pen/gXZOWp?editors=0001

Hey everyone, I’m having a little issue with my wikipedia viewer project. When I give an input, “Canada” for example, it returns “undefined” in the console, but actually returns results for “undefined” from wikipedia lol. Any help would be much appreciated! Thanks,

Marcel

The following line is the problem:

var searchTerm = $("searchTerm").val();

After it executes, searchTerm has a value of undefined, because you are not correctly referencing the input with id=“searchTerm”. Take a look at this documentation to see where you went wrong.

You may also want to review the following Free Code Camp challenge.

2 Likes

Ok got it, I made a similar mistake before except last time I added a ‘#’ where it didn’t belong, this time I forgot one. Thanks again!