![]() Preserved Topic: trying to add values in a text field (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: Cincinnati, OH |
![]() I'm trying to add values from text fields and put the total in another field. I've tried converting them to integers using parseInt, but no matter what I try, it just does text adds (e.g. 2+2=22 instead of 4). |
Maniac (V) Mad Scientist From: New California |
![]() TheDude, |
Nervous Wreck (II) Inmate From: Cincinnati, OH |
![]() Thanks! |
Maniac (V) Mad Scientist From: New California |
![]() |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() Also consider parseFloat if you want to allow decimals. |
Nervous Wreck (II) Inmate From: Cincinnati, OH |
![]() Thanks Slime! Turns out, I do have a decimal so I needed to know that function. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() Hmm, if you *really* want to learn JavaScript, well, then get a book - I recommend JavaScript: The Definitive Guide from O'Reilly ( www.oreilly.com ). |
Paranoid (IV) Inmate From: 127.0.0.1 |
![]() |