Random Quote Generator Help!

I am having trouble with Javascript part. I don’t understand Javascript too well, so I am wondering if anyone can give me any tips on how to clean this up or to get it mildly working and pulling in quotes.

https://codepen.io/daghering/pen/gJvZMW

3 errors that you can correct to atleast display some quotes

  1. you refer to the wrong element for your event generation event listener
  $("#newQuote").on("click", function() {
    getQuote();
  });

the element id you want to attach it to is actually called #new-quote

  1. Your function refrence is also wrong , the function you want to refer to is getQuotes()

  2. In jQuery, when you wan to select a class element you precede it with a period but an id element should be preceded with a hashtag(#), see this line below
    $(".text").text(randomQuote)

Do these above to at least generate and display your quotes, but there is still a lot more room for improvement

1 Like

Thanks a lot for the quick feedback! That helps a lot.

I have passed every step except “the #quote-box wrapper element should be horizontally centered.” I cannot seem to get this one? Any help would be appreciated!

All the tests pass for me, sometimes it will get stuck on test#8 or #9, but that is because you only have 4 quotes to choose from and you can’t have the same quote consecutively generated, remedy for that is to add more quotes to your array.

1 Like