Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding two variables in java script.

 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I try to add two values from a hidden variables, it gets concatinated.
Can any one tell me how can i add it ?


[ December 23, 2005: Message edited by: Srinivasa Raghavan ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are strings, so you need to parseFloat() or parseInt() to convert them before adding.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic