Stuck in Random Quote Machine

Hi guys!

I was building my RandomQuoteMachine and ran into some problems. Each time when I clicked the tweet button, the original webpage just turned blank. I have tried many methods but still havn’t found the real cause. Please help me to find it!!

Millions of thanks!

Here’s my codepen link:

FYI - I am fairly certain you did not write all that code for the stars animation, so you should give credit back to the code author where you got this code.

You can stop the default behavior by using event.preventDefault(); in your event handler or having the last line be of handler as return false; .

Your anchor is not really navigating so much as it is acting as a button so when clicked it “navigates” to this blank page

Of course I will add his name . The project has not been completed yet, and I prefer to do the commenting job in the end. So do you know what’s the cause for that problem?:sweat_smile:

Did you try @alhazen1’s suggestion?

His method works! Thanks to both of you!

Thanks for your reply. It’s very helpful. :grinning: