JSFiddle - React, Tailwind, and code Playground

HTML

<input id='amount-input'>

<div id='amount'>
  0
</div>

<div id='fee'>
  -0.10000000
</div>

<div id='result'>
  0
</div>

CSS

#result {
  margin-top: 10px;
  font-weight: bold;
}

JavaScript

$(document).ready(function() {
  $(document).on('input','#amount-input', function() {
    $('#amount').text(parseFloat($(this).val()).toFixed(8))
    calculateFees()
  })

  function calculateFees(self) {
    var amount = parseFloat($('#amount').text())
    var fees = parseFloat($('#fee').text())
    
    
    // both of these don't work for big numbers
    //$('#result').text(amount ? (amount + fees).toFixed(8) > 0 ? (amount + fees).toFixed(8) : 0 : 0)
    $('#result').text(amount ? (amount + fees).toFixed(8) > 0 ? (((amount + fees) * 100000000) / 100000000) : 0 : 0)
  }

})