JSFiddle - React, Tailwind, and code Playground

by Dave Mednick

HTML

<input type="text" id="value_one" />
<br />
<input type="text" id="value_two" />
<br />
<input type="text" id="total_value" />
<br />
<button id="totalme">Total</button>

JavaScript

$("#totalme").click(function () {
    var a = $('#value_one').val();
    var b = $('#value_two').val();
    var fltA = Number(a.replace(/[^0-9\.]+/g, ""));
    var fltB = Number(b.replace(/[^0-9\.]+/g, ""));
    var total = fltA + fltB;
    $('#total_value').val(total);

});