JSFiddle - React, Tailwind, and code Playground
by itpates
HTML
<input class="checkadd" onblur="if (this.value=='') this.value='0.00';" onfocus="if (this.value=='0.00') this.value='';" onkeyup="return calculateSum()" data-events="[]" placeholder="Amount" id="amount0" value="" name="checklista[0][checkamount]" type="text">
<input class="checkadd" onblur="if (this.value=='') this.value='0.00';" onfocus="if (this.value=='0.00') this.value='';" onkeyup="return calculateSum()" data-events="[]" placeholder="Amount" id="amount1" value="" name="checklista[1][checkamount]" type="text">
<input class="checkadd" onblur="if (this.value=='') this.value='0.00';" onfocus="if (this.value=='0.00') this.value='';" onkeyup="return calculateSum()" data-events="[]" placeholder="Amount" id="amount2" value="" name="checklista[2][checkamount]" type="text">
<input id="totalSum" class="totalSum" type="text" value="" name="totalSum">
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
b,
#totalSum {
color: black;
}
JavaScript
function calculateSum() {
var totalSum = getElementById("totalSum").value || 0;
var sum = 0;
getElementById("totalSum").value = totalSum;
}