• 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
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!