Random Quote Machine tweet button


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?



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

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

//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.