Help: Twitter button on Random Quote Machine opens codepen in new window

Looking for some support:

When I use the Twitter button for my random quote machine it opens up another tab with the random quote machine in it instead of twitter. Any suggestions for fixing this would be greatly appreciated.

Codepen

The anonymous function in the following line never runs, because you do not have an element with the id of “newQuote”.

$("#newQuote").on("click", function(){

plus the entire code block associated with this line above needs to be moved outside of the function called newQuote.

1 Like

Thank you, RMDawson. After you pointed this out I was able to get the twitter button working correctly.