I have several cards in one page and each card has a tanned option of facebook, when I click on the image the counter increases by 1, but it counts on all the cards and not only on what I clicked and also every time I I would like a user to click on it aumenta um
if they click it again diminui um
equal facebook like
dislike
.
Here is an example of what I have today
var count = 0;
$(".click").click(function() {
count++;
$(".click").css('opacity', "0.7");
$(".like").html(count + "Curtidas");
$(this).off(event);
});
.click {
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<ul>
<li class='click'>Clique</li>
<li class='like'>0 curtidas</li>
</ul>
</div>
<div>
<ul>
<li class='click'>Clique</li>
<li class='like'>0 curtidas</li>
</ul>
</div>
<div>
<ul>
<li class='click'>Clique</li>
<li class='like'>0 curtidas</li>
</ul>
</div>