Hi all,
I am trying to add two numbers together and output them using jQuery. My input types are set to "number" and need to stay that way. I have tried the following, but get a result of NaN:
<input type="number" id="primaryincome" class="form-control" placeholder="0">
<input type="number" id="otherincome" class="form-control" placeholder="0">
<input type="number" id="totalamountremaining" class="form-control" placeholder="0" readonly>
var primaryincome = $("#primaryincome").val();
var otherincome = $("#otherincome").val();
var totalincome = parseInt(primaryincome) + parseInt(otherincome);
$("#calculate").click(function () {
alert(totalincome);
$("#totalamountremaining").val(totalincome);