There are 2 input number fields, using javascript, the value entered in one overwrites and displays the value in another field
<input id="goods" type="number" oninput="makePrice();"> <input id="price" type="number" oninput="makeGoods();"> function makePrice() { var temp = document.getElementById("goods").value; var price = temp * 0.14;//Здесь может быть другой коэффициент document.getElementById("price").value = price; } The function MakeGoods () is similar (if the user wants to buy a product, at some price, and not by the number of goods)
As in the input id = price field, make a value with a floating point so that after the comma the price in kopecks, even if an integer is obtained, it doesn’t matter that it displays a number, for example 100.00.
In the input id = goods field, on the contrary, when entering a price, to round up to a whole number of product units.
How to do it, with the help of JS, or HTML, point to the correct idea.