Javascript : How to increase a fraction value in a textbox ? example: 0.10 to 0.11 -


this question has answer here:

i need increase fraction in text box using javascript.

the goal add 1 penny until 0.99 , 1.00 , 1.01

how can done in javascript?

this not working.

var a; = document.getelementbyid('a1').value; = a+a; alert(a); 

alert returns

0.100.10 

additional info

var a; = parsefloat(document.getelementbyid('b13').value); = a+a; alert(a); 

returns

0.2 

i rather see 0.20

but importantly, how increase 0.01 @ time ?

solved:

both

var a; = parsefloat(document.getelementbyid('a1').value); = a+0.01; alert(a); } 

and ...

document.getelementbyid('a1').value = +document.getelementbyid('a1').value + 0.01 

worked fine.

text box returns value string parse it

var a; = parsefloat(document.getelementbyid('a1').value); = (a+a).tofixed(2); alert(a); 

and doesn't adds 0.01 a .. doubles a use this.

var a; = parsefloat(document.getelementbyid('a1').value); = (a + 0.01).tofixed(2); alert(a); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -