i have <span class="gramatz">(8)</span> and i would like it to add +1 or take -1 from 8, leaving () untouched, when I click my love button.
$(function() {
$(".love").click(function() {
var id = $(this).attr("id");
var dataString = 'id=' + id;
var parent = $(this);
$(this).fadeOut(300);
$.ajax({
type: "POST",
url: "bookmark.php",
data: dataString,
cache: false,
success: function(html) {
parent.html(html);
parent.fadeIn(300);
}
});
return false;
});
});
UPDATE: I forgot I need to decrease the value aswell, check the picture for details: http://img593.imageshack.us/img593/6128/ss20110921031605.png
so if user clicks on +, I need to increase the value, if user clicks on – I need to decrease the number.
so if the icon has + it has this <div class="over_img"> </div> and if – it has this <div class="on_img"> </div>
P.S. plus an minus icons are generated from div background
Needed to use
.live()to do the trick