I could Not Load 2 Twitter widgets. The 2nd Widget is loaded on a click event at a later time. What could be causing it to not load?


How do we load the 2nd widget at a later time (i.e., via click event?) All I’m doing is adding the html code inside the innerHTML, but the 2nd widget woudln’t load. If I remove one of the widgets, the other widget is able to load accordingly. How can I have the 2nd one working?


A Twitter button or widget loads on your page by Twitter’s JavaScript scanning the DOM for an element + classname it recognizes and interpreting the result. You may also dynamically insert using our JavaScript factory functions.

If you are inserting new HTML into a page after Twitter’s widgets JavaScript has loaded and performed its initial scan of the page you’ll need to trigger a new scan by calling twttr.widgets.load().

You may also use a JavaScript factory function such as twttr.widgets.createTweet() to insert a single Tweet.


Thanks, @niall. If I may ask, do you have a simple fiddle example for this?

EDIT: I found a stackoverflow post that has an example. Thanks!

closed #4