on clicking each emoji, we’ll collect unique identifier from data-reaction attribute and we’ll add respective class to like statistics section or small emoji section. we’ll use jQuery to handle click and undo click event.

when we clicking emoji we are adding an “active” class to the like button. When you’ll going to undo your reaction, first we’ll identify active state then we’ll clean up emoji class by removing them all and adding default class and text.

When you’ll implement this into a live project there should be some ajax call on click or undo event. Check the demo, if you like, comment below your words. All images/sprite has been downloaded from facebook.

Post navigation

Join other 2000+ web developers who decided to subscribe my newsletter to stay up to date with Angularjs, Php, NodeJs, Javascript and other cool topics regarding web development. I promise I won’t spam you :)