Random Quote Machine - Tweet button issue

Hi All,

My Random Quote Machine works perfectly but the tweet button works only in Google Chrome and locally on my machine.
If I open the same code web page with Firefox Developer Edition or in Codepen, the tweet button does not work.

Your help would be highly appreciated.

Two things that might help.

The $("#tweetbutton") should be $("#tweetButton") with a capital B to match your html id.

Your line :

$("a").attr("href", "https://www.twitter.com/intent/tweet?hashtags=randomQuoteMachine&text=") + encodeURIComponent(randomQuote + " - " + randomAuthor);

Should be written like this:

$("a").attr("href", "https://www.twitter.com/intent/tweet?hashtags=randomQuoteMachine&text=" + encodeURIComponent(randomQuote + " - " + randomAuthor));

The difference is the closing parenthesis needed to be moved to the end before the semi-colon.

Hope this helps a bit.

1 Like

Hi,

Thanks for your response, it actually helped for Codepen but only on Chrome. I am still having the same issue on Firefox. It seems there some support issue here :sweat_smile:

Hi @camperextraordinaire :slightly_smiling_face:

That worked perfectly. Was this related to browser support?

Thanks a lot!!!