My Quote machine feedback (and two fixes please!)

Hi everyone!

I’m back again after a while completing a full stack online course - but it’s so different when you have to build a project yourself rather than just code along - even though it has given me a good foundation I think.

I really struggled with a few things and it’s so hard not to get so frustrated and annoyed at why some things weren’t working. I think it has knocked my confidence a bit, but I have to keep my motivation. I had to look so many things up too.

I’d really like feedback on the quote machine I made: https://codepen.io/Joethedeveloper42/full/JMQrpb/

I tried to keep it simple and clean.

Two really annoying aspects that I hope someone can help me fix:

  1. When I try to quote to twitter, it generates a new quote and posts that to twitter, rather than the current quote that I want to post. Can anyone help me with that?

  2. And this is REALLY frustrating me as I’ve searched and I can’t fix it, but I can click either side of my tweet button (ie not on the button) and it still works. I think it’s because I’m clicking the div or something but if someone could help me with this that would be great.

Thank you so much in advance.

Joe

You were adding the quotes yourself:

//                                                                  here            and here
window.open("https://twitter.com/intent/tweet?hashtags=Brent&text=" + "'" + randomQuote + "'  ");

You might also want to use encodeURIComponent on randomQuote to make it more URL-safe.

window.open('https://twitter.com/intent/tweet?hashtags=Brent&text=' + encodeURIComponent(randomQuote))

I also noticed another thing. Clicking the Tweet button generates a new quote before opening the Tweet window. You should change this:

$("button").click(function(){

to a different selector that targets just the New Quote button.

I don’t experience this behavior. Have you fixed this already?

Hi Kev,

Thanks for your feedback and help - much appreciated. Yes, I managed to fix the first issue and I will use URL encoded too. I will try and fix the button issue and debug as well, thanks for your help!

kind regards

Joe