Is there\'s any way to format an input[type=\'number\'] value to always show 2 decimal places?
Example: I want to see 0.00 instead of
The top answer gave me the solution but I didn't like that the user input was changed immediately so I added delay which in my opinion contributes to a better user experience
var delayTimer;
function input(ele) {
clearTimeout(delayTimer);
delayTimer = setTimeout(function() {
ele.value = parseFloat(ele.value).toFixed(2).toString();
}, 800);
}
https://jsfiddle.net/908rLhek/1/