I’m almost done with the random quote machine project. My problem is after you click a button to get a quote, the Tweet button turns into a hyperlink, underlined blue text.
The tweet button looks like a button, blue with the bird, before you click “Get Message”, but after you get your quote the button looks bad. I’d like it to look nice.
Here’s the HTML that sets up the button.
<div id="share-button"> <a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=Hello%20world" data-size="large"> Tweet</a> </div>
When a user click’s “Get Quote”, a jQuery
.html function runs and should insert new code into the div with id
share-button and it does that except for carrying over the
data-size="large" bit somehow, I believe. I don’t know why.
My jQuery (i did a lot of
+= because I was having trouble getting the whole string I wanted to concatenate in one line, like with
+s, I don’t know why).
var tweet = '<a class="twitter-share-button" href="https://twitter.com/intent/tweet?text='; tweet += json.quoteText; tweet += " -"; tweet += author; tweet += '" '; tweet += 'data-size="large">Tweet</a>'; $("#share-button").html(tweet);
You can see the Pen at http://codepen.io/whosyerricky/full/BzRzbY/