i have one counter for script but i want to use the same for counter.
i am open for all changes in class and id.
here is the code:
$(document).ready(function(){
$('#target').click(function() {
$('#output').text(function(i, val) { return val*1+1 });
});
$('#targetdown1').click(function() {
$('#output').text(function(i, val) { return val*1-1 });
});
});
here is the example:
One of the solution i am using not just for your case, is to write the target id of an element i need to update as an attribute on the initiate element
In your case i have added an data attribute on each +/- sign that indicate what is the target element needed to update
HTML Code
Jquery Code
Fiddle Example