I have this HTML form:
<div>
Amount 1: <input id="amount1" type="text" />
<br>
Amount 2: <input id="amount2" type="text" value="0.00">
<br>
<span id="result"></span>
</div>
And this Jquery code:
$("#amount1").keyup(calc);
$("#amount2").keyup(calc);
function calc() {
$('#result').val(
parseInt($('#amount1').val(), 10) + parseInt($("#amount2").val(), 10)
);
}
What I'm trying to do is simply calculating and displaying amount1+amount2 when someone inputs numbers into the forms. Note that amount1 is 0.00 by default.
When I run it, it doesn't calculate anything. What am I doing wrong here?
spanelements dont contain.valmethod - instead set the.textpropertyvalue="0.00"when obviously you are looking for integer (amount value)???