I have a problem with adding a cookie. Read a couple of answers, but it's hard to understand if you never worked with them before.
What I basically want is to add a cookie if someone click on the specified button. So for example, if person clicked on the like button, hidden content will be revealed no matter if he go forward/back or refresh page and cookie shall be removed after a couple of days.
What I used to hide the content is following:
HTML:
<div id=fd>
<p>Button from below will become active once you hit like button!</p>
<div id=get-it>
<a class=button><img src=img/get-button.png></a>
</div>
</div>
<div id='feedback' style='display:none'></div>
javascript:
FB.Event.subscribe('edge.create', function (response) {
$('#feedback').fadeIn().html('<p>Thank you. You may proceed now!</p><br/><div id=get-it><a class=button2 href=pick.html><img src=img/get-button.png></a></div>');
$('#fd').fadeOut();
});
However if I hit refresh or go back/forward on the content page, it will be hidden again. This is reason why I want to add a cookie on button hit. Anyone who can give me some explanations or example code?