JSFiddle - React, Tailwind, and code Playground
by Denis Ineshin
HTML
<input type="text" class="inp" name="width" value="1" />
<input type="text" class="inp" name="height" value="1" />
<input type="text" class="inp" name="thickness" value="1" />
<br/>
Итого: <span class="reslut">1</span>
JavaScript
var $result = $(".reslut"),
$w = $("[name='width']"),
$h = $("[name='height']"),
$t = $("[name='thickness']"),
width = 1,
height = 1,
thickness = 1;
function calc () {
var result = width * height * thickness;
$result.text(result + " руб.");
}
$w.on("keyup", function () {
width = +$(this).prop("value");
calc();
});
$h.on("keyup", function () {
height = +$(this).prop("value");
calc();
});
$t.on("keyup", function () {
thickness = +$(this).prop("value");
calc();
});