[SOLVED]Help with Random Quote Machine (first quote won't disappear)

[SOLVED]Help with Random Quote Machine (first quote won't disappear)
0

#1

Hey! So for the most part my quote machine is working (it pulls in the quotes from the api and the user can opt to tweet the quote). However I decided to place my own quote which is in the text field by default so the user wont load up an empty page. At first my newly added quote kept appearing alongside the quotes pulled from the api, but then I eventually added a function which hides my own quote once the user clicks the button to get a new quote. For the most part it works, but it only registers after a few clicks (meaning my own quote only stops appearing in the text field after 3 or so clicks), and it’s kinda buggy, at least in the start.

Here’s the link to my pen: https://codepen.io/bfgonzalez/pen/VyvyLO?editors=0010

Any suggestions? Thanks!


#2

Why do you have two separate quote divs? Why not put your own quote the in div with id=“quote” to start with? Your newQuote function already takes care of putting a new quote in the same div. That way, you do not have to hide/show any divs.


#3

That makes sense! Updated it with your suggestion and now it works, thank you so much!!