Simple increase/decrese... or?


I have a button that increase or decrease a value depending on if it has a class of active or not.

However. if the element has active on page load, and i click it, the value decreases by one as it is supposed to do, but if I then click the button again it increases up to one above the original value, when I want it do increase with 1 up to the value we originally had. I suck at explaining but here is a fiddle with the two scenarios (button with active on load and button without active).

You need to update the data-numb attribute (the numb is a local variable, not attached to the html attribute.

if added this right outside the if statements'numb', numb);
1 Like


1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.