Increase and decrease should add or subtract 0.1 to the current value. They are setup the same. For some reason decrease works (1.0 becomes 0.9, 0.8, etc.) but increase does not (1.0 becomes 1.00.1) as if it's concatenating a string.
I have tried with parseInt and parseFloat with no luck on increase new_value = current_value + 0.1
but decrease does work new_value = current_value - 0.1
I would expect both to either work on not work the way this is setup.
HTML:
<button data-direction="increase">increase</button>
<button data-direction="decrease">decrease</button>
<input value="1.0" />
JS:
$(function() {
var button = $('button');
button.click(function() {
var button = $(this);
var direction = button.data('direction');
var input = $('input');
var current_value = parseFloat( input.val() ).toFixed(1);
var new_value;
if (direction=='increase') {
new_value = current_value + 0.1;
} else {
new_value = current_value - 0.1;
}
input.val(new_value);
});
});
Fiddle: