This is the HTML code:
<input type="number" class="small" value="0" step="any" id="input_1_0" name="input_25">
<input type="number" class="small" value="0" step="any" id="input_1_1" name="input_26">
<input type="number" class="small" value="0" step="any" id="input_1_2" name="input_27">
<p><b>Total:</b> <span id="total_cost">0</span></p>
and this is jQuery:
var total_cost;
jQuery(document).ready(function(){
jQuery('input').change(function() {
var input1 = Number((jQuery('#input_1_0').val()).replace(/[^0-9\.]+/g,""));
var input2 = Number((jQuery('#input_1_1').val()).replace(/[^0-9\.]+/g,""));
var input3 = Number((jQuery('#input_1_2').val()).replace(/[^0-9\.]+/g,""));
total_cost = input1 + input2 + input3;
});
jQuery(function(){
jQuery('#total_cost').text(total_cost);
});
});
For some reasons the Total is not being updated when numeric values are entered in input fields. Any help would be appreciated.