这又是我。我一直在尝试所有的东西,但它只是一只耳朵而另一只耳朵。
如何截断浮点数?
我已尝试Math.floor
,round
,toFixed
等等。
我该怎么办呢?
var off = 10/100;
var value = 25.55;
var final = value-off * value;
$("#teste").val(final.toFixed(2));
<!Doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<title> Hallo Leute! Alles klar,nö? Helfe mir! :D </title>
</head>
<body>
<input type="text" name="test" id="teste">
<p> I'd like see result : 29.99 </p>
</body>
</html>