Need help debugging twitter button on quote generator

Need help debugging twitter button on quote generator
0.0 0

#1

When I click my twitter button it opens a new tab for the current quote as well as all preceding quotes that have been generated. For example, if I attempt to tweet the third generated quote, the tweet button will open new tabs for the first, second and third quote.

Any help as to how to get it to only open a tab for the current quote would be appreciated.

Thanks in advance.


#2
//line 25
btn2.addEventListener("click", function() {
  //console.log(text[num]);
  window.open('https://twitter.com/intent/tweet?text=' + '"' + text + '" ' + author);
});

You’re adding an event listener every time someone gets a new quote. You should only do this once, and then change what is display with each quote.