JSFiddle - React, Tailwind, and code Playground
by andyjh07
HTML
<span class="likebox" title="156195591205453156195591205453"></span>
JavaScript
$(document).ready(function () {
(function ($) {
$.fn.fblikecount = function (options) {
var defaults = {
baseUrl: 'http://graph.facebook.com/'
};
var options = $.extend(defaults, options);
var count = 0;
return this.each(function () {
var $this = $(this);
$this.hide();
var objLink = $(this).attr('title');
if (objLink.indexOf('http') === 0) {
$.getJSON(defaults.baseUrl + objLink + '&callback=?', function (json) {
if(json[objLink] && json[objLink].likes){
$this.html(json[objLink].likes);
$this.show();
}
});
}
});
}
})(jQuery);
$('span.likebox').fblikecount();
});