In an <input type="number">, I can type the following invalid input in Chrome:
- Type 11,
- Move the caret in the middle between both 1s,
- Type -.
However, I cannot type this invalid input:
- Type 1e,
- Move the caret in the middle between the 1and thee,
- Press -; it won’t be typed.
But both of these values are invalid: input.value is the empty string.
What is the logic behind this behavior?
Example below for you to type numbers:
addEventListener("input", ({ target: { value } }) => document.querySelector("p").textContent = value);<input type="number"/>
<p></p> 
     
    