Dynamically add facebook button using jquery

How can I dynamically add a facebook button using jquery? I plan to have a gallery and want to add such buttons for each image? I tried this but does nothing: $ ('. Share_button'). append ("(fb: like layout = 'button_count' font = 'tahoma') (/ fb: like)") where share_button is the class name of the div tag that will contain the type button.

Thanks in advance, Ivan

+5
source share
2 answers

First of all, it should be:

$('.share_button').append("<fb:like layout='button_count' font='tahoma'></fb:like>")

Then you should add this line:

FB.XFBML.parse($('.share_button').get(0));

, , , , .share_button.

+7

XMLNS: = "http://www.facebook.com/2008/fbml"

, FB, . , SO

+2

All Articles