Reputation: 61
Here is the HTML code:
<a class="tweet">
<button class="btn btn-default btn-md">
<i class="fa fa-twitter hidden-sm hidden-md hidden-lg"></i><span class="hidden-xs">Tweet This</span>
</button>
</a>
And the gist of the JS
function tweet(message, author) {
window.open('https://twitter.com/intent/tweet?hashtags=thequotemachine&text=' + encodeURIComponent('"' + message + '" ' + author + " via"));
}
and
$('button.tweet').click(function() {
var currQuote = $('#quote').text();
var currAuthor = $('#author').text();
var truncatedString = truncateString(currQuote, currAuthor)
tweet(truncatedString, currAuthor);
});
When clicking it is supposed to take 'quote', which is a piece of text from the page, and it's supposed to open a new window for the user to 'tweet' that quote. Right now it does nothing when clicked but I can't figure out why. I'm sure I'm missing something very embarrassingly basic. Maybe I just need a second set of eyes on this...
Upvotes: 0
Views: 48
Reputation: 2768
Your selector button.tweet
would match a button
with the class tweet
. From your HTML structure you need .tweet button
or just ad .tweet
to your button element.
Upvotes: 2