I am trying to get a tweet button that shares customized text. The problem is that text is randomized. i.e. I have a random quote generator but I want to share the quote that is being displayed at that time so to my knowledge.
<a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=Hello%20world>Tweet</a>
Won't work because I don't know what the text will be at any given time.
The Javascript is an Array called 'quotes' of quotes pushed through.
function cycle() {
var randomNumber = Math.floor(Math.random() * (quote.length));
document.getElementByID('getit').innerHTML = quote[randomNumber];
}
and in HTML I have a button that cycles through the loop like so.
<button type="button" class="btn btn-primary onclick="cycle()">Get New Quote</button>
So, any ideas as to how this can be done?