JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" class="amount"/><br/>
<input type="text" class="amount"/><br/>
<input type="text" class="amount"/><br/><br/>
<input type="text" id="total"/><br/>

JavaScript

$('.amount').change(function() {
    $('#total').attr('value', function() {
        var result = 0;
        $('.amount').each(function() {
            result += $(this).attr('value');
        });
        return result;
    });
});