JSFiddle - React, Tailwind, and code Playground
by kuroir
HTML
<input value="">
JavaScript
function frmtCurrency(ele,price) {
// round the currency to the nearest .05
price = parseFloat(price);
if(isNaN(price)) { price = 0 }
price *= 2.0;
price = price.toFixed(1) / 2.0;
price = price.toFixed(2);
ele.val(price);
}
frmtCurrency($('input'), '');