Type d'entrée qui permet le numéro de flotteur
<input type="number" step="0.01">
Amused Ant
<input type="number" step="0.01">
(3.141596).toFixed(2); // 3.14
var myNumber=12.2345;
var myNumberWithTwoDecimalPlaces=parseFloat(myNumber).toFixed(2); //12.23
34
43
34
23
1
2
3
4
5
6
6
//HazaaZOOZ - javascript - How to use limit input to 2 decimal places
var validate = function(e) {
var t = e.value;
e.value = (t.indexOf(".") >= 0) ? (t.substr(0, t.indexOf(".")) + t.substr(t.indexOf("."), 3)) : t;
}