javascript - Adding more than one to a variable on click -
so add +1 variable use code varname++;
if want increament value of say, 4 on click how should code look?
this exampel code:
var varname = 1; $('.button').click(function{ varname++; });
also, code revert this? i.e decrease variable specific value.
you're looking +=
, -=
:
$('.button').click(function{ varname += 4; // increment 4 // varname -= 4; decrement 4 });
i'd suggest familirise javascript operators.
Comments
Post a Comment