Help with my random quote machine

Help with my random quote machine
0

#1

I can not set the first quote. It works after you click next but when the page loads I don’t know how to do. Please give me a hint, here is my project


#2

Hey, if you place all the code that is executed when you click the button in a separate function, you can call the function:

  • when the event is triggered
  • directly when the page is loaded

You could also add $(".next").trigger("click"); after your event listener. This will trigger the event and indirect the code inside the event handler.


#3

I tried it but obviously i did something wrong. I have to put from the getJSON part or first close the document ready function?


#4

You have to include the getJSON part. You can put the function outside the document ready function, but it I believe it shouldn’t matter. Here is a working pen: http://codepen.io/benjaminvanzwienen/pen/EgkYKj?editors=1010


#5

Thank you very much I was messing it when I called my functions :grin: