Help with random quote machine tweet button

I am having trouble with my RQM tweet button.
I am brand new to coding so I am trying to do this project as simply as I can while meeting the criteria.
I have looked at others’ projects but they were beyond my abilities.

here is what I have so far

I can get a twitter window to open but haven’t figured out how to add a variable to the link to open whichever quote is currently displayed.

Thanks in advance,

Hi lonies87,

You could store the quote in a variable and then add that variable to the twitter url.

var curQuote = quotes[randomNumber];” += curQuote

Also, I’d recommend using the FCC gitter chat. Usually you can get quick replies there.

You can also access it directly off the page. You put it on the page with the selector document.getElementById('quoteDisplay').innerHTML - and that works both ways. Try:

function tweetQuote(){

and you’ll see it in your console.

Though, I found this a more direct way to tweet:"" + text);

Just sub in your selector for my variable text.

I have tried this soln and the one above but I still can’t get the quote in tweeter.

When I put the tweetQuote function in the newQuote function, I don’t get any link when clicking tweet button.
When I make them two separate functions and put quoteDisplay after the twitter url, I get the twitter window but the text box reads “[object HTMLDivElement]”

I have tried different ways to assign the quote to a variable then call for it in the tweetQuote function but I can’t figure it out.

When I plug the selector I suggested into your tweet function, it works for me:

function tweetQuote(){"" + document.getElementById('quoteDisplay').innerHTML);

Let me know if this still doesn’t work for you.

1 Like

This time it worked! Thank you so much

Thank you, this also helped me with my project :slight_smile: