Hi why if I create a variable in my backend:
var price = 10.10;
When I render la page the var is truncate to 10.1?
<span class="form-group-field">Price: € <%=price%></span><br>
<input type="hidden" id="price" name="price" value="<%=price%>"/>
Hi why if I create a variable in my backend:
var price = 10.10;
When I render la page the var is truncate to 10.1?
<span class="form-group-field">Price: € <%=price%></span><br>
<input type="hidden" id="price" name="price" value="<%=price%>"/>
You have to use toFixed method as javascript removes the 0's after the decimal
var price = 10.10
price.toFixed(2) //it will result 10.10