I’ve been working on the Random Quote Machine challenge and have a working machine - apart from the tweet quote button.
I’ve been scouring the web for hours and can’t seem to find a solution that works. Currently the closest I have come is tweeting a random quote (not the same as the one displayed on my page) that also includes formatting that I obviously don’t want. i.e. the h3 and italic bits. I know why what I have done does this but it’s the closest I can get!
I’m not sure if the problem is how I’ve created the quote machine, or if it is just that I can’t find a way to reproduce what is being displayed in my quote machine and storing in a variable or suchlike.
@StuJ89…I initially struggled with this a bit myself since the Twitter developer documentation is lengthy and complex. However, in the end I just looked at the HTML generated by the ‘Share on Twitter’ option of the Share button at the bottom of the CodePen page. I hope this helps and feel free to look at my Random Quote Generator if you get stuck.
Your random quote is being generated inside the .html() method. Try assigning it to a variable before setting it as the content of the ‘quote’ class. Then you can set the textToTweet variable to the same quote (using the variable from earlier) instead of generating a new quote for the textToTweet variable.