Question: how to subtract two numbers in jquery?
Answer: $(function() {
$('input[name^=sum]').keyup(function() {
var sum1 = parseFloat($('input[name=sum1]').val()); // Or parseInt if integers only.
var sum2 = parseFloat($('input[name=sum2]').val());
$('#totalSum').val(sum2 - sum1);
});
});