I have a php foreach that generates divs with class .like-button1,2,3,4.. and generate more forms form1,2,3,4...
The goal is that when users click on "like" the div shows the text message:
"You like: www.facebook.com/ferrari"
The script works correctly but the .hover function is not what I really want, because if you click on the first like in the like-button1 div and you go on the second div, the text message appears on that second div.
I can't find a right way to identify the right div, if you click the like inside div with class like-button1 show text message and submit the form in that div, without possibly avoiding the script just hovering an other div.
Thanks to all.
FB.Event.subscribe('edge.create', function (response) {
$(".like-button1").hover(function() {
$(".like-button1").text('Ti piace: ' + response);
$("#form1").submit();
});
$(".like-button2").hover(function() {
$(".like-button2").text('Ti piace: ' + response);
$("#form2").submit();
});
$(".like-button3").hover(function() {
$(".like-button3").text('Ti piace: ' + response);
$("#form3").submit();
});
});