This is not working, becouse if you have a placeholder it will take by default that value and you can't change it in input. So if someone else stumbles upon this here is a JavaScript solution to this problem: Step 1: Hook your HTML number input box to an onchange event. Why was video, audio and picture compression the poorest when storage space was the costliest? This is just a minimalist solution, but yes using jQuery could make the OPs life easier. What server side language do you use? Look into toFixed for Javascript numbers. What are some tips to improve this product photo? how to verify the setting of linux ntp client? The user hits "Backspace", the value turns into "0.20", and it appears impossible to delete any more characters, because "0" is always added at the end by the function. I want a simple calculation form. So if someone else stumbles upon this here is a JavaScript solution to this problem: Step 1: Hook your HTML number input box to an onchange event, Step 2: Write the setTwoDecimalPlace method. Why am I being blocked from installing Windows 11 2022H2 because of printer driver compatibility, even with no printers installed? Connect and share knowledge within a single location that is structured and easy to search. Accurate way to calculate the impact of X hours of meetings a day on an individual's "deep thinking" time available? What was the significance of the word "ordinary" in "lords of appeal in ordinary"? The rationale for this is that number inputs can't contain anything except numbers, and you can constrain the minimum and maximum number of valid digits using the min and max attributes, as . The result is 0.132, which has three. Is a potential juror protected for what they say during jury selection? To do that we can listen for the blur event and attach the same callback to it. How can I set the default value for an HTML