I am buidling an app in which feed entries will be commented with Facebook Comments. I would like to just show the Facebook Comments box once the user clicks a “Comment” button, hence dynamically trigger the opening of this feed element’s Facebook Comment box through a javascript event. I tried the following code but it doesn’t work, the javascript which opens the FB Comments box must somehow not be executed by Facebook. Any idea what’s going wrong with my approach? Is there any FB.ui event I should play with, too?
$(".triggerLink").live("click",function() {
var FBbox = "<div class='fb-comments' data-href='http://something.com' data-num-posts='3' data-width='400'></div>";
$("#commentsContainer").show().html(FBbox);
});
You need to tell Facebook to parse the XFBML.
This will trigger XFBML parsing inside the container.