I've made this javascript code, to check if the user has liked my fb or not, what I want is to check from javascript that if the user, in this case, doesn't have the cookie show the div.
I've searched whatever I could find but couldn't actually figure it out.
//fbb
});
//Additional
(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#xfbml=1&version=v2.4&appId";
fjs.parentNode.insertBefore(js, fjs);
FB.Event.subscribe('edge.create',
function (response) {
$(".fb-like").fadeOut();
setCookie("username", "user", "365");
}
);
}(document, 'script', 'facebook-jssdk'));
function myFunction(){
var dummytext=getCookie("username");
console.log(dummytext);
if (dummytext == "user") {
$(".fb-like").fadeOut();
}
}
window.onload = myFunction;
So all I want to is that if dummytext != "user"/cookie doesn't exists, show this div:
<div class="name"><div class="fb-like" data-href="http://facebook.com/facebook/" data-layout="button" data-action="like" data-show-faces="false" data-share="false"></div></div>