The way it’s normally done is for each person to have their own individual account (think Facebook or Reddit) and to record the like against their account number,
It’s just an “appreciate button”, with no connection to accounts, So I guess using cookies is the way to do it then? I’m quite a novice when it comes to cookies and that stuff, do you have any tips on good resources that can help me achieve this?
So, I don’t really know how to incorporate the cookie functions you gave me with my current code.
What I have “accomplished” so far is to add a class, count clicks and disable the button after one click:
What I need to do now is, with the help of cookies, make the click remembered when the visitor visits the site again. I also need to increase the click count for every time a new user clicks it, for example if 5 people have clicked the button, I want the counter to show 5 for the sixth person, before he clicks.
I don’t really know where to start or how to do this but if you or anyone else would like to help me i would be really grateful, and maybe learn something about cookies in the process.
Well, full proof isn’t really super important for this use case scenario since the voting/like -button is more of a “fun thing”, that neither break or make the site. It’s going to be on my personal portfolio, at the bottom of each case study I want to have this “Appreciation”-button.
That would have been great, that is, if the user is being kept on session. But with a user who is not logged in, the problem is about keeping track of the identity of the use to avoid multiple clicks on the button by the same user.