JSON Button Disappears - Random Quote Machine

JSON Button Disappears - Random Quote Machine
0

#1

I’ve made some progress with my random quote machine project, but whenever I click my “Get Quote” button to generate a new quote, the button disappears. I need to refresh the page to make it appear again.

It works properly when I take the section in the HTML out of my quote-container div class for some reason.

Here is the link to my codepen:

https://codepen.io/nabramow/pen/MEPMdv

Can anyone point me in the right direction of why my button is disappearing, why taking it out of the div class fixes it, and how I can have the button stay there while also having it stay in my quote-container box?

Thank you!


#2

It’s because button is inside your <div class="quote-container quoteMessage"> and you replace whole content of this div in $.getJSON on line 11


#4

Thank you so much! I’ve just turned it into two separate div classes and that fixed it. I also understand what the $.getJSON line was doing more now.