On click even does not change text

I’m on the first challenge in the intermediate front end projects

The quotes randomly change when refreshed as expected, but the click event doesn’t do anything. What am I missing?

You actually have two issues, but you are not seeing one of them.

To answer your main question, when the quote text (h1 element) is clicked (I actually recommend a button instead), nothing happens, because you need to specify the function updateQuote and not execute the function updateQuote. You need to change:



$("h1").click(updateQuote);  // no parentheses

The second problem which could not seen because the onclick event was not doing anything, is that updateQuote will keep using the same value for randNum, because it is only called one time using a IIFE.

The easiest fix for this is to make randNum a stand-alone function which you would call insdie updateQuote and assign to a variable to be used with your Quotes and Credits objects.

So you would have:

var randNum = function() { 
  var num = Math.random();
  num = num * 4;
  num = Math.floor(num);
  return num;

and inside updateQuote, you would have:

function updateQuote() {
  var rand = randNum();

Thank you so much, it works perfectly now. Yes I intended to add a button and finish out meeting all the requirements for the challenge, I was just using what I had to get things working before adding the button.

Thanks again!