I’m having trouble getting the Tweet button in my quote generator to behave correctly.
I know this has been asked plenty of times before, but reading through some of the existing posts and trying things that were suggested there hasn’t fixed anything so far. Unsure what I’m doing wrong at this point!
The first time it loads, when I click the tweet button, the tweet populates with the correct quote. However, if I generate a new quote and then click tweet again, the text hasn’t updated to the new quote. Can anybody give me a clue as to what is wrong with my code?
(Also it’s including the codepen URL in my tweet (which it doesn’t do when I run it locally), but I assume that is just a codepen thing)
From doing a bit of digging, I’ve understood that I may need to create a new Tweet button each time I generate a new quote (so when clicking the new quote button), but I’m not sure how to go about this. I’ve looked into using the replacing my link tags with the createShareButton method and putting that in my getNewQuote() function and that didn’t seem to play ball either! The console in Chrome just keeps giving me error messages anytime I deviate from the code you see in the codepen above :
Any pointers will be gratefully received