JSFiddle - React, Tailwind, and code Playground

by gabrieleromanato

HTML

<div id="twitter-followers"></div>

JavaScript

(function($) {
    $.fn.twitterFollowers = function(options) {

        var that = this;
        options = $.extend({
            username: 'gabromanato'
        }, options);
        var apiURL = 'https://api.twitter.com/1/users/show.json?screen_name=' + options.username + '&callback=?';

        return that.each(function() {

            $.getJSON(apiURL, function(data) {

                $(that).text(data.followers_count + ' followers');

            });


        });

    };
})(jQuery);


$('#twitter-followers').twitterFollowers();