答案 0 :(得分:0)
$('.number').keyup(function() {
var sum = 0;
$('.number').each(function() {
sum += Number($(this).val());
});
$('.total').val(sum);
});
<input type="text" id="text1">
<input type="text" class="number" >+
<input type="text" class="number" >=
<input type="text" class="total" >
<!-- I want to substract 1st text input value and the last text total value if the values ar not same display message-->