Performing Arithmetic on Currency Values in the form of Text using Javascript

Posted by Abs on Stack Overflow See other posts from Stack Overflow or by Abs
Published on 2010-03-22T12:56:59Z Indexed on 2010/03/22 13:01 UTC
Read the original article Hit count: 466

Filed under:
|
|

Hello all,

I am using JQuery to get the contents of a div, which only contains a price in dollars and I would like to add $99 to it, but its text, so when I do the below it won't work.

$('#price_' + part[0]).text($('#price_' + part[0]).text() + 99);
//Changes the div contents to $10099 - if it the contents was $100 to start with

So the question is how can I add the numeric values?

Thanks all

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery