JSFiddle - React, Tailwind, and code Playground

by naveen

HTML

<div id="container">
<form action="something.html" id="subit">
<label for="first">put numbers</label><input type="text" id="first"/>
<label for="second">more numbers</label><input type="text" id="second" value="0"/>
<label for="third">and more numbers</label><input type="text" id="third" value="0"/>
<input type="submit" />
</form>
    <div id="result"></div>
</div>

JavaScript

var textboxes = $("#container input:text");
textboxes.on("keyup", function() {
    var amt = 0;
    textboxes.each(function() {
        amt += +$(this).val();
    });
    $("#result").html(amt);
});