The value you entered in the input field id="thousands" will be multiplied by 1000 and the result will be displayed to the input field id="thousands-output". That part of the code is working perfectly. What i want is to get the sum of the value of all the multiplied outputs and display it in the input field id="totalBills". I cant seem to solve this issue. Any help would be appreciated
HTML Code:
<label>1000</label>
<div class="input-group">
<input type="number" class="form-control" name="thousands" id="thousands" />
<span class="input-group-addon">=</span>
<input type="text" class="form-control txt" id="thousands-output" style="width:70%;" readonly />
</div>
<label>500</label>
<div class="input-group">
<input type="number" class="form-control" name="five_hundreds" id="five_hundreds"/>
<span class="input-group-addon">=</span>
<input type="text" class="form-control txt" id="five_hundreds-output" style="width:70%;" readonly />
</div>
<input type="total" id="totalBills" class="form-control" value="0">
Javascript Code:
var $output = $("#thousands-output");
$("#thousands").keyup(function() {
var value = parseFloat($(this).val());
$output.val(value*1000);
});
var $output2 = $("#five_hundreds-output");
$("#five_hundreds").keyup(function() {
var value = parseFloat($(this).val());
$output2.val(value*500);
});