JSFiddle - React, Tailwind, and code Playground

by Vojtech Mares

HTML

<body>
     <h3>FB share : </h3>

    <input id="shareContent"></input>
    <button id="btnShare">Share</button>
    <button id="btnGetStatus">Get Login Status</button>
</body>

JavaScript

$(document).ready(function () {

    window.fbAsyncInit = function () {
        FB.init({
            appId: '525160900928657',
            xfbml: true,
            version: 'v2.0',
            status: true

        });
    };

    (function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {
            return;
        }
        js = d.createElement(s);
        js.id = id;
        js.src = "//connect.facebook.net/en_US/sdk.js";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));

    $('#btnGetStatus').click(function () {
     
        FB.getLoginStatus(function (response) {
            console.log(response);
            if (response.status === 'connected') {
                console.log('Logged in.');
            } else {
                console.log('logging in.')
                FB.login();
               
            }
        });
    });


});