And you’re right.
The problem is that your tweet button’s event listener is inside your ‘next quote’ button’s event listener. So, you have to click on that button first to attach the click event to you tweet button. Try to move it outside of that block.
A few other things… I’ve noticed you used jQuery, and although I haven’t used it in the last few years, I think
append() is to add nodes/DOM elements and you should use a simple
.text() to add your first quote. And I’d also swap the
.text()s, unless you get an HMTL string in response from the API.
Oh, and if you already use it, you can use jQuery in your
tweet() function, instead of vanilla JS.