Robert Granlund
asked on
Addition in Jquery
I am trying to do addition in JQuery but I'm not sure what I am doing:
baseOne = 1000;
baseTwo = 300
baseOne = 1000;
baseTwo = 300
var baseOne = document.getElementById('custom-price').value;
var baseTwo= document.getElementById('valueOfAccessories').valu);
var preBase = baseOne + baseTwo;
For preBAse I get 1000300 instead of 1300. What am I doing wrong?
you've a typo end of line 2, valu); -> value;
ASKER
@Gary, when I do that it gives me 301. It took the first three zeros off on 1000.
baseOne = 1000;
baseTwo = 300
baseOne = 1000;
baseTwo = 300
var baseOne = document.getElementById('custom-price').value;
var baseTwo = document.getElementById('valueOfAccessories').value;
var preBase = parseInt(baseOne) + parseInt(baseTwo);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window