I am new to javaScript. I am building a calculator here
I have stored the input values in variables so that I can eventually manipulate the results to perform calcul
Instead of using parseInt, you can multiply number by 1. Its much faster and easier method to covert datatype.
$(document).ready(function () {
var theTerm = $("#theTerm").val() * 1;
var theRate = $("#theRate").val() * 1;
var thePrice = $("#thePrice").val() * 1;
var theTax = $("#theTax").val() * 1;
var theDown = $("#theDown").val() * 1;
var theTrade = $("#theTrade").val() * 1;
var theResult = theTerm + theRate + thePrice + theTax + theDown + theTrade;
$("#calculate").click(function () {
alert(theResult);
alert(typeof (theResult));
});
});
JSFiddle: http://jsfiddle.net/RqzPk/14/