Help with twitter button in Random Quote Machine

Hi everybody,

I am stuck in the random quote machine. The problem I am facing now is that every new quote generates a new twitter button without deleting the previous one. I don’t completely understand how this button is generated, how the data (text, hashtags) are edited dynamically so I really don’t know how to delete old button when new one is generated.

Any help is extremely appreciated. Thanks in advance.

You could simply add container.innerHTML = ''; to the top of your tweetBtn function after your variables.

You can also implement the Tweet button yourself reasonably easily. Here’s what I did for my project:

  • implement a button-styled link (with Bootstrap) with a Twitter icon from FontAwesome.
  • when you display the quote, you also update the button’s href.

On a side note I think on line 49 “aync” should be “async”.

Thank you, that worked perfectly. Why didn-t I think about it? :slight_smile: Thanks

Well spotted thank you, I would have passed one hour longer looking for a solution. Thanks

I am curious about how you implemented it exactly. Is your project still online so I can have a look at it?

I would definitely add more space padding between the 2 buttons. They are too close to each other and it makes it hard to click. But I :heart: the overall look an feel of the page.

Well it still needs improvements but sure, you can have a look. Please ignore the test suite. I added it to check if the app was compatible with the beta and it’s not. I’m working on something else right now so that will wait.