Need HELP with random quote generator tweet button!

Need HELP with random quote generator tweet button!
0

#1

Hi all!!
I need some help with tweet button in my random quote generator app!
Heres my code:

<div class="d-flex p-5 align-self-cente justify-content-center">
    <div class="speech">
      <div class="container justify-content-center">
        <blockquote class="blockquote-reverse">
          <p class="mb-0" id="quoteDisplay">Talk is cheap. Show me the code. - Linus Torvalds</p>
        </blockquote>
        <button type="button" class="btn btn-primary" onclick="newQuote()">button</button>
        <a class="twitter-share-button" type="button" id="tweetQuote" onclick="tweetQuote" target="_blank" href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a>
      </div>
    </div>
  </div>
function newQuote() {
  var randomNumber = Math.floor(Math.random() * (quotes.length));
  document.getElementById('quoteDisplay').innerHTML = quotes[randomNumber];
  var tweetQuote = quotes[randomNumber].split(' ').join('%20');
  tweetQuote = tweetQuote.split('<br>').join('');
  tweetQuote = 'https://twitter.com/intent/tweet?text=' + tweetQuote.split('"').join('')
  $('.twitter-share-button').attr('href', tweetQuote);
}

When i press the tweet button it only opens new tab with the same page instead of tweet box with quote!

Where in my code is problem???


#2

Okay! Never mind!
It started working after i moved id from twitter button and onclick event