Random Quote Machine - Almost there, but not there (SOLVED)

I am having trouble with Tweet Quote button.

The text is always the default quote (the one that is shown before the user clicks on “Inspire Me” button for the first time), and not the current quote.

You can try declaring a global tweetUrl variable. Then when you hit “Tweet Quote”, after displaying the quote on the page, modify the URL with the same values. Of course your window.open() should then use tweetUrl.

1 Like

That worked, thank you so much!

Now I understand: everything that happens to html and variables happens on click on “Inspire Me” button. All that tweetQuote function does is open the window with the text that was actually ready after that “Inspire Me” click.

function tweetQuote() {
window.open(tweetUrl, ‘_blank’);