Creating tweet button dynamically via JavaScript


#1

We have a cms to allow our users to dynamically add multiple elements to a page with a tweet button. In order for the user to add these elements, they click a button that opens a new window to allow them to specify the tweet text included with each button. When they hit save, we inject into the parent page the new tweet button element and when we do this though, just the Tweet link is shown instead the tweet button image.

What is the function called in this file http://platform.twitter.com/widgets.js that we can call to have the code loop through our page to find the appropriate elements tagged with twitter-share-button and tweetbutton class to render out the tweet button (full image).

Thanks, Brad


#2

I believe you’re looking for this function: twttr.render(); which you can execute once your page is completed loading.


#3

In different areas of discussion/documentation it states to use twttr.widgets.load() to re-evaluate dynamically loaded content…how are they different, or the same?


#4

Update: this function will rescan the page and re-render the added widgets.
twttr.widgets.load()


#5

please give the code of tweet button here


#6

HOLA!


#7

please give me the code for my tweet button here!


#8

twitter, u are the best !


#9

I want a twitter button guys. How do I create it?


#10

#11

#12