Problem with Random quote machine in codepen

Hi. There is a link to my github page with quote machine:

Everything works great. But in codepen:

twitter button does not work. Who know how to fix ? Thanks

On Codepen your code is displayed inside an iframe and it does not allow to load other sites inside of it. And that is exactly what you are doing by setting location.href. So if you want it to work with Codepen, you will have to open twitter in a new tab.

Could you please help me ? Cause ) does not work right =)

//location.href = twitter + x;

still nothing, just open page without quote. Ok thanks =)

Did you first click “New quote”?

EDIT: this is what I get.

yes, maybe some bugs in code

So do you get the ‘#quotes’ inside the tweet box?

So do you see a quote on your site?

no, github page also do not work

Yeah, if you are blocking the pop-ups it won’t work

1 Like

I find the problem =) thanks

But know it opens two windows =) omg

That is because you are adding multiple eventListeners (every time you click ‘new quote’).

Thanks, I’ll try to fix it

I used this to tweet"" + $("#quote").html());

Opening twitter to tweet + the value of the element where the tweet is store down on my page $("#quote").html());

Credit - this video at 3:08