Stuck in Random Quote Machine

Stuck in Random Quote Machine
0

#1

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: https://codepen.io/Alexsunnik/pen/mjMgaN


#2

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.


#3

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


#4

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:


#5

Did you try @alhazen1’s suggestion?


#6

His method works! Thanks to both of you!


#7

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