JSFiddle - React, Tailwind, and code Playground

by mowglisanu

HTML

<div id="qty-a-row" contenteditable="true">2</div><br>
<div id="price-a-row" contenteditable="true">1.00</div><br>
<div id="sub-total-a-row" contenteditable="true"></div>

JavaScript

var contents = $(".qty-a-row").html();
$("#qty-a-row").blur(function () {
  if (contents != $(this).html()) {
    var x = parseInt(document.getElementById("qty-a-row").innerText);
    var y = parseInt(document.getElementById("price-a-row").innerText);
    document.getElementById("sub-total-a-row").innerText = (x * y);
  }
});