JSFiddle - React, Tailwind, and code Playground
HTML
<input id="quantity" size="30" type="number" value="1"/>
<p id="total" value="29.99">29.99</p>
JavaScript
$(document).ready(function() {
function updatePrice() {
var num = parseInt($("#quantity").val());
var price = (num) * parseFloat($("#total").text());
var total = price.toFixed(2);
$("#total").replaceWith(total);
$('body').append(price);
}
$(document).on("change, mouseup, keyup", "#quantity", updatePrice);
});