I need to increase a fraction in a text box using javascript.
the goal is to add 1 penny until it is 0.99 and then it will be 1.00 and 1.01
how can this be done in javascript?
this is what is not working.
var a;
a = document.getElementById('a1').value;
a = a+a;
alert(a);
alert returns
0.100.10
Additional Info
var a;
a = parseFloat(document.getElementById('b13').value);
a = a+a;
alert(a);
returns
0.2
i would rather see 0.20
but most importantly, how do increase this by 0.01 at a time ?
SOLVED:
both
var a;
a = parseFloat(document.getElementById('a1').value);
a = a+0.01;
alert(a);
}
and ...
document.getElementById('a1').value = +document.getElementById('a1').value + 0.01
worked fine.