Troubleshooting Front End Libraries Projects - Build a Random Quote Machine

Hello,

I’ve passed all of the tests for this project, however my tweet button doesn’t function properly… After watching a few videos I found how to use JS to attach the proper href to my tweet-quote button, but still can’t figure it out. I’ve tried both via

document.getElementById('tweet-quote').href = twitterLink

as well as

$('#tweet-quote').attr('href', 'https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text=' + quoteFormatted + authorFormatted);

I’ve found that both work outside of the getQuote function, however I have no way of (Or simply don’t know how to) accessing the current quote outside of the function’s scope. It works properly until I try to add the current quote (passing it in as a variable), which I then get redirected back to the pen. I

Still fairly new to many of these concepts so trying to figure out how to resolve my issues. Any direction or help would be greatly appreciated!

Ignore the terrible styling, I used aggressive colors so I could know that my styling was correct.

This is a link to my codepen: https://codepen.io/tazmancooks/pen/KKdEVbv

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.

Challenge: Build a Random Quote Machine

Link to the challenge:

image
Hello~!

I show you passing all tests. :slight_smile:

1 Like

Hey there!

I think it may be passing due to there being any link, but when you click the tweet button it doesn’t function properly. Being a bit of a perfectionist I suppose but I def want to know that it works properly! For some reason, when I click the tweet button, it redirects to the pen.

I just updated the OP explaining my issue a bit better. I’m having issues with the ‘quoteFormatted’ and ‘authorFormatted’ variables. Once I try to add them to the twitterLink variable, the tweet button begins to redirect to the current codepen rather than to the twitter website.