JSFiddle - React, Tailwind, and code Playground

by giovannyMarin

HTML

<form action="#">
  Enter the no: <input type="text" name="precio_venta" id="precio_venta" /><br />
  <label id="error"></label>
</form>

CSS

form {
  border: 1px solid #444;
  background-color: #eee;
  margin: 20px;
  padding: 10px;
}

#error {
  margin: 5px;
  background-color: #bc0000;
  color: #FFFFFF;
  display: block;
}

JavaScript

function floorFigure(figure, decimals){
    if (!decimals) decimals = 2;
    var d = Math.pow(10,decimals);
    return (parseInt(figure*d)/d).toFixed(decimals);
};