This is a jquery function that increments num (other function decreases num by one) on click of two different button, however i want them to be incrementing and decreasing the SAME variable, as it is now, when the one button is clicked, num is incremented, however when the other button is clicked it starts from one again and goes down from one when it should use the amount from the other num if you know what i mean.
$(".eventer button[name=lol]").click(function() {
num = $(this).data('num');
if (typeof num != 'number') {
num = 1;
}
$(this).attr('disabled', true); // don't allow a second click until previous action has completed
//$.ajax('javas.php', { success: function(response) {
$(this).parent().next('.status').html(num);
$(this).data('num', ++num);
$(this).attr('disabled', false); // reset
//})
});
$(".eventer button[name=myBtn]").click(function() {
num = $(this).data('num');
if (typeof num != 'number') {
num = 1;
}
$(this).attr('disabled', true); // don't allow a second click until previous action has completed
//$.ajax('javas.php', { success: function(response) {
$(this).parent().next('.status').html(num);
$(this).data('num', --num);
$(this).attr('disabled', false); // reset
//})
});
Any help is appreciated thanks.