So I have everything I need for the random quote machine to work, but I can’t seem to figure out how to get the tweet button to work. The closest I’ve gotten is getting the twitter window to open, the text to populate with a string I have set, but the index of my array shows up instead of the quote text. It’s rather frustrating.
Any ideas? I know I’m close, I just don’t stuck at the moment.
Here’s my codepen: http://codepen.io/Qwicksilver/pen/xOjPdx
A quick workaround would be
- Create a global
tweetUrl variable at the top of your code.
tweetUrl = 'https://twitter.com/intent/tweet?text=' + aquote[rdmQuote] + ' - Rick Sanchez'; right after the line that chooses a random index.
window.open(tweetUrl); inside the
That was exactly what I needed. Thank you! That was driving me insane for most of the night last night.
Hello, I’m having some problems with the tweet button as well. I implemented the method used in this thread but there still seems to be a problem.
Here’s the link to my codepen: https://codepen.io/mayankgupta02/pen/WOMBjK?editors=1010