Random Quote Machine tweet button


#1

Hi all,
I am having trouble with the tweet button on my RQM.

Any ideas on why the site doesn’t open when the tweet button is clicked?


#2

#3

Codepen requires you to open your links in a new Window. I’ve adjusted your code as followed:

Replace:
//When tweet is clicked $('#twitter').click(function() { $(this).attr("href", 'https://twitter.com/intent/tweet?text=' + currentQuote + currentAuthor); });

With:
//When tweet is clicked $('#twitter').click(function() { window.open('https://twitter.com/intent/tweet?text=' + currentQuote + " " + currentAuthor, '_blank'); });

There is another issue though your ‘currentQuote’ variable contains a <p> tag which gets inserted into the tweet, you’ll need to remove the <p> take from that variable.