Help with a liking system in a repeater

For some reason I’m struggling trying to a simple “like” system working properly. Basically I have a repeater setup thats connected to a collection “Messages”. The collection Messages has 3 fields (message, author, and count). Everything in the collection is displaying properly through the dataset on the page. I have 2 icons (thumbs up) with ids (#like, and #liked). I’ve tried using a bunch of different code modifying to match my collection and fields but the count field will never change. Can anyone help with a quick code that when #like is clicked it will increment “count” by 1? I already have #like hidden on click and #liked appearing. I just cant get the collection field to update.

You should use wixData.update() + use a beforeUpdate hook that finds the current value and adds 1, then you should refresh your dataset.
Try to do it, and if it doesn’t work for you, you can post your code here for review.

Another solution is that since the collection is already updating properly, you simply add a boolean variable in your code and display the icon and += 1 to the value of your like counter based on the boolean after the collection has been updated.