3
I have several cards on a page and each card has an equal facebook like option, when I click on the image the counter increases 1, however this counting in all the cards and not only in what I clicked and also each time I click up one would like that if the user click once it aumenta um
if you click it again diminui um
facebook equal like
dislike
.
Follow 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>
How much time have you spent doing this?
– PauloHDSousa
@Is Paulohdsousa important to you? If yes, I did not spend a lot of time not in vdd at the time is not something as serious as I started to stir I wonder if it is possible only with JS to do this.
– user27585
It is possible to do only with JS.
– PauloHDSousa
@Paulohdsousa thank you, answered one of my doubts.
– user27585