Hello I have 3 input text fields and one dynamic one. When i click i want it to display the total of the 3. right now im getting the 3 numbers in sequence
ex.
2+2+2 = 222
i need it to say 6
thnx
on (release) {
myTot_var = h1_var+h2_var+h3_var;
}
Printable View
Hello I have 3 input text fields and one dynamic one. When i click i want it to display the total of the 3. right now im getting the 3 numbers in sequence
ex.
2+2+2 = 222
i need it to say 6
thnx
on (release) {
myTot_var = h1_var+h2_var+h3_var;
}
Use parseInt to make the textfield values be interpreted as numbers instead of strings:
code:
myTot_var = parseInt(h1_var)+parseInt(h2_var)+parseInt(h3_var)
If they are floating points, use parseFloat. You can also use:
code:
new Number(h1_var)
thanks for the respone Buddy!
I tried the code and now im getting
NaN in the dynamic field
And one more question
what actions will i need to reset the fields to 0
How did you solved the NaN problem ??? Thanks.